From 61bb218e012391c6d077ae5f39da111cd3f61aa8 Mon Sep 17 00:00:00 2001 From: Igor Sapego Date: Mon, 15 Mar 2021 11:24:25 +0300 Subject: [PATCH] IGNITE-13767: Removed PHP, Node.js and Python from main repo This closes #8512 --- README.txt | 3 - assembly/release-apache-ignite-base.xml | 76 - docs/_docs/quick-start/nodejs.adoc | 6 +- docs/_docs/quick-start/php.adoc | 17 +- docs/_docs/quick-start/python.adoc | 2 +- .../thin-clients/nodejs-thin-client.adoc | 4 +- docs/_docs/thin-clients/php-thin-client.adoc | 14 +- .../thin-clients/python-thin-client.adoc | 8 +- modules/platforms/nodejs/README.md | 32 - modules/platforms/nodejs/api_spec/conf.json | 12 - .../nodejs/examples/AuthTlsExample.js | 128 - .../nodejs/examples/CachePutGetExample.js | 186 -- .../nodejs/examples/FailoverExample.js | 59 - .../platforms/nodejs/examples/SqlExample.js | 242 -- .../nodejs/examples/SqlQueryEntriesExample.js | 136 - .../platforms/nodejs/examples/certs/ca.crt | 32 - .../nodejs/examples/certs/client.crt | 30 - .../nodejs/examples/certs/client.key | 51 - .../nodejs/examples/certs/keystore.jks | Bin 3828 -> 0 bytes .../nodejs/examples/certs/truststore.jks | Bin 1477 -> 0 bytes modules/platforms/nodejs/index.js | 43 - modules/platforms/nodejs/lib/BinaryObject.js | 530 ---- modules/platforms/nodejs/lib/CacheClient.js | 759 ----- .../nodejs/lib/CacheConfiguration.js | 1734 ------------ modules/platforms/nodejs/lib/Cursor.js | 307 -- modules/platforms/nodejs/lib/EnumItem.js | 212 -- modules/platforms/nodejs/lib/Errors.js | 133 - modules/platforms/nodejs/lib/IgniteClient.js | 290 -- .../nodejs/lib/IgniteClientConfiguration.js | 112 - modules/platforms/nodejs/lib/ObjectType.js | 600 ---- modules/platforms/nodejs/lib/Query.js | 508 ---- modules/platforms/nodejs/lib/Timestamp.js | 76 - .../nodejs/lib/internal/ArgumentChecker.js | 83 - .../nodejs/lib/internal/BinaryCommunicator.js | 409 --- .../nodejs/lib/internal/BinaryType.js | 483 ---- .../nodejs/lib/internal/BinaryTypeStorage.js | 112 - .../nodejs/lib/internal/BinaryUtils.js | 602 ---- .../lib/internal/ClientFailoverSocket.js | 134 - .../nodejs/lib/internal/ClientSocket.js | 454 --- .../platforms/nodejs/lib/internal/Logger.js | 45 - .../nodejs/lib/internal/MessageBuffer.js | 293 -- modules/platforms/nodejs/package.json | 40 - .../platforms/nodejs/spec/ExamplesExecutor.js | 28 - .../platforms/nodejs/spec/TestingHelper.js | 391 --- .../nodejs/spec/cache/BinaryObject.spec.js | 176 -- .../platforms/nodejs/spec/cache/Cache.spec.js | 262 -- .../spec/cache/CacheKeyValueOps.spec.js | 1022 ------- .../spec/cache/CachePutGetDiffTypes.spec.js | 686 ----- .../nodejs/spec/cache/ComplexObject.spec.js | 540 ---- .../platforms/nodejs/spec/cache/UUID.spec.js | 105 - modules/platforms/nodejs/spec/config.js | 27 - .../nodejs/spec/examples/AuthExample.spec.js | 33 - .../nodejs/spec/examples/Examples.spec.js | 45 - .../nodejs/spec/query/ScanQuery.spec.js | 207 -- .../nodejs/spec/query/SqlFieldsQuery.spec.js | 266 -- .../nodejs/spec/query/SqlQuery.spec.js | 247 -- .../nodejs/spec/support/jasmine.json | 11 - modules/platforms/php/.gitignore | 2 - modules/platforms/php/README.md | 37 - modules/platforms/php/api_docs/Doxyfile | 2487 ----------------- modules/platforms/php/composer.json | 27 - .../platforms/php/examples/AuthTlsExample.php | 129 - .../php/examples/CachePutGetExample.php | 184 -- .../php/examples/FailoverExample.php | 67 - modules/platforms/php/examples/SqlExample.php | 237 -- .../php/examples/SqlQueryEntriesExample.php | 127 - modules/platforms/php/examples/certs/ca.pem | 32 - .../platforms/php/examples/certs/client.pem | 81 - .../platforms/php/examples/certs/keystore.jks | Bin 3828 -> 0 bytes .../php/examples/certs/truststore.jks | Bin 1477 -> 0 bytes .../Ignite/Cache/CacheConfiguration.php | 1011 ------- .../src/Apache/Ignite/Cache/CacheEntry.php | 60 - .../Apache/Ignite/Cache/CacheInterface.php | 379 --- .../Ignite/Cache/CacheKeyConfiguration.php | 107 - .../src/Apache/Ignite/Cache/QueryEntity.php | 315 --- .../src/Apache/Ignite/Cache/QueryField.php | 279 -- .../src/Apache/Ignite/Cache/QueryIndex.php | 191 -- .../php/src/Apache/Ignite/Client.php | 243 -- .../src/Apache/Ignite/ClientConfiguration.php | 294 -- .../src/Apache/Ignite/Data/BinaryObject.php | 469 ---- .../php/src/Apache/Ignite/Data/Date.php | 83 - .../php/src/Apache/Ignite/Data/EnumItem.php | 155 - .../php/src/Apache/Ignite/Data/Time.php | 58 - .../php/src/Apache/Ignite/Data/Timestamp.php | 66 - .../Ignite/Exception/ClientException.php | 35 - .../Exception/NoConnectionException.php | 35 - .../Ignite/Exception/OperationException.php | 35 - .../OperationStatusUnknownException.php | 35 - .../Internal/Binary/BinaryCommunicator.php | 493 ---- .../Ignite/Internal/Binary/BinaryField.php | 78 - .../Internal/Binary/BinaryObjectField.php | 113 - .../Ignite/Internal/Binary/BinarySchema.php | 145 - .../Ignite/Internal/Binary/BinaryType.php | 233 -- .../Internal/Binary/BinaryTypeBuilder.php | 207 -- .../Internal/Binary/BinaryTypeStorage.php | 123 - .../Ignite/Internal/Binary/BinaryUtils.php | 450 --- .../Internal/Binary/ClientOperation.php | 64 - .../Ignite/Internal/Binary/MessageBuffer.php | 307 -- .../Apache/Ignite/Internal/Binary/Request.php | 85 - .../Ignite/Internal/Binary/TypeInfo.php | 312 --- .../php/src/Apache/Ignite/Internal/Cache.php | 387 --- .../Connection/ClientFailoverSocket.php | 134 - .../Internal/Connection/ClientSocket.php | 247 -- .../Internal/Connection/ProtocolVersion.php | 82 - .../Apache/Ignite/Internal/Query/Cursor.php | 166 -- .../Ignite/Internal/Query/SqlFieldsCursor.php | 75 - .../Ignite/Internal/Utils/ArgumentChecker.php | 87 - .../Apache/Ignite/Internal/Utils/Logger.php | 62 - .../Apache/Ignite/Query/CursorInterface.php | 56 - .../php/src/Apache/Ignite/Query/Query.php | 70 - .../php/src/Apache/Ignite/Query/ScanQuery.php | 88 - .../Ignite/Query/SqlFieldsCursorInterface.php | 82 - .../Apache/Ignite/Query/SqlFieldsQuery.php | 206 -- .../php/src/Apache/Ignite/Query/SqlQuery.php | 225 -- .../Ignite/Type/CollectionObjectType.php | 142 - .../Apache/Ignite/Type/ComplexObjectType.php | 165 -- .../src/Apache/Ignite/Type/MapObjectType.php | 123 - .../Apache/Ignite/Type/ObjectArrayType.php | 68 - .../php/src/Apache/Ignite/Type/ObjectType.php | 442 --- .../platforms/php/tests/BinaryObjectTest.php | 196 -- .../php/tests/CacheKeyValueOpsTest.php | 763 ----- .../platforms/php/tests/CachePutGetTest.php | 765 ----- modules/platforms/php/tests/CacheTest.php | 240 -- .../platforms/php/tests/ComplexObjectTest.php | 428 --- modules/platforms/php/tests/ScanQueryTest.php | 167 -- .../php/tests/SqlFieldsQueryTest.php | 224 -- modules/platforms/php/tests/SqlQueryTest.php | 204 -- modules/platforms/php/tests/TestConfig.php | 37 - modules/platforms/php/tests/TestingHelper.php | 363 --- .../tests/examples/ExecuteAuthTlsExample.php | 36 - .../php/tests/examples/ExecuteExamples.php | 61 - modules/platforms/python/LICENSE | 202 -- modules/platforms/python/README.md | 75 - modules/platforms/python/docs/Makefile | 20 - modules/platforms/python/docs/conf.py | 176 -- .../python/docs/datatypes/cache_props.rst | 163 -- .../python/docs/datatypes/parsers.rst | 175 -- modules/platforms/python/docs/examples.rst | 624 ----- modules/platforms/python/docs/index.rst | 33 - modules/platforms/python/docs/modules.rst | 31 - modules/platforms/python/docs/readme.rst | 202 -- .../platforms/python/docs/source/modules.rst | 7 - .../docs/source/pyignite.api.binary.rst | 7 - .../docs/source/pyignite.api.cache_config.rst | 7 - .../docs/source/pyignite.api.key_value.rst | 7 - .../docs/source/pyignite.api.result.rst | 7 - .../python/docs/source/pyignite.api.rst | 19 - .../python/docs/source/pyignite.api.sql.rst | 7 - .../python/docs/source/pyignite.binary.rst | 7 - .../python/docs/source/pyignite.cache.rst | 7 - .../python/docs/source/pyignite.client.rst | 7 - .../source/pyignite.connection.generators.rst | 7 - .../source/pyignite.connection.handshake.rst | 7 - .../docs/source/pyignite.connection.rst | 17 - .../docs/source/pyignite.connection.ssl.rst | 7 - .../python/docs/source/pyignite.constants.rst | 7 - .../docs/source/pyignite.datatypes.base.rst | 7 - .../docs/source/pyignite.datatypes.binary.rst | 7 - .../pyignite.datatypes.cache_config.rst | 7 - .../pyignite.datatypes.cache_properties.rst | 7 - .../source/pyignite.datatypes.complex.rst | 7 - .../source/pyignite.datatypes.internal.rst | 7 - .../source/pyignite.datatypes.key_value.rst | 7 - .../source/pyignite.datatypes.null_object.rst | 7 - .../source/pyignite.datatypes.primitive.rst | 7 - .../pyignite.datatypes.primitive_arrays.rst | 7 - .../pyignite.datatypes.primitive_objects.rst | 7 - .../source/pyignite.datatypes.prop_codes.rst | 7 - .../python/docs/source/pyignite.datatypes.rst | 29 - .../docs/source/pyignite.datatypes.sql.rst | 7 - .../source/pyignite.datatypes.standard.rst | 7 - .../source/pyignite.datatypes.type_codes.rst | 7 - .../docs/source/pyignite.exceptions.rst | 7 - .../docs/source/pyignite.queries.op_codes.rst | 7 - .../python/docs/source/pyignite.queries.rst | 15 - .../platforms/python/docs/source/pyignite.rst | 30 - .../python/docs/source/pyignite.utils.rst | 7 - .../python/examples/binary_basics.py | 53 - .../python/examples/create_binary.py | 103 - modules/platforms/python/examples/failover.py | 61 - .../platforms/python/examples/get_and_put.py | 41 - .../python/examples/migrate_binary.py | 190 -- .../platforms/python/examples/read_binary.py | 275 -- modules/platforms/python/examples/readme.md | 17 - modules/platforms/python/examples/scans.py | 55 - modules/platforms/python/examples/sql.py | 298 -- .../platforms/python/examples/type_hints.py | 51 - modules/platforms/python/pyignite/__init__.py | 17 - .../platforms/python/pyignite/api/__init__.py | 71 - .../platforms/python/pyignite/api/binary.py | 209 -- .../python/pyignite/api/cache_config.py | 279 -- .../python/pyignite/api/key_value.py | 995 ------- .../platforms/python/pyignite/api/result.py | 38 - modules/platforms/python/pyignite/api/sql.py | 475 ---- modules/platforms/python/pyignite/binary.py | 136 - modules/platforms/python/pyignite/cache.py | 595 ---- modules/platforms/python/pyignite/client.py | 406 --- .../python/pyignite/connection/__init__.py | 333 --- .../python/pyignite/connection/generators.py | 48 - .../python/pyignite/connection/handshake.py | 91 - .../python/pyignite/connection/ssl.py | 49 - .../platforms/python/pyignite/constants.py | 52 - .../python/pyignite/datatypes/__init__.py | 27 - .../python/pyignite/datatypes/base.py | 24 - .../python/pyignite/datatypes/binary.py | 45 - .../python/pyignite/datatypes/cache_config.py | 153 - .../pyignite/datatypes/cache_properties.py | 287 -- .../python/pyignite/datatypes/complex.py | 526 ---- .../python/pyignite/datatypes/internal.py | 472 ---- .../python/pyignite/datatypes/key_value.py | 24 - .../python/pyignite/datatypes/null_object.py | 64 - .../python/pyignite/datatypes/primitive.py | 106 - .../pyignite/datatypes/primitive_arrays.py | 208 -- .../pyignite/datatypes/primitive_objects.py | 158 -- .../python/pyignite/datatypes/prop_codes.py | 51 - .../python/pyignite/datatypes/sql.py | 23 - .../python/pyignite/datatypes/standard.py | 739 ----- .../python/pyignite/datatypes/type_codes.py | 57 - .../platforms/python/pyignite/exceptions.py | 80 - .../python/pyignite/queries/__init__.py | 339 --- .../python/pyignite/queries/op_codes.py | 65 - modules/platforms/python/pyignite/utils.py | 172 -- .../platforms/python/requirements/docs.txt | 6 - .../platforms/python/requirements/install.txt | 4 - .../platforms/python/requirements/setup.txt | 3 - .../platforms/python/requirements/tests.txt | 5 - modules/platforms/python/setup.py | 104 - modules/platforms/python/tests/config/ssl.xml | 58 - .../python/tests/config/ssl/README.txt | 3 - .../python/tests/config/ssl/client_full.pem | 52 - .../config/ssl/client_with_pass_full.pem | 54 - .../python/tests/config/ssl/server.jks | Bin 2380 -> 0 bytes .../python/tests/config/ssl/trust.jks | Bin 1346 -> 0 bytes modules/platforms/python/tests/conftest.py | 227 -- modules/platforms/python/tests/test_binary.py | 280 -- .../python/tests/test_cache_class.py | 221 -- .../python/tests/test_cache_class_sql.py | 103 - .../python/tests/test_cache_config.py | 75 - .../platforms/python/tests/test_datatypes.py | 176 -- .../platforms/python/tests/test_examples.py | 57 - .../python/tests/test_generic_object.py | 33 - .../platforms/python/tests/test_get_names.py | 30 - .../platforms/python/tests/test_handshake.py | 64 - .../platforms/python/tests/test_key_value.py | 400 --- modules/platforms/python/tests/test_scan.py | 66 - modules/platforms/python/tests/test_sql.py | 184 -- parent/pom.xml | 9 - 247 files changed, 28 insertions(+), 42076 deletions(-) delete mode 100644 modules/platforms/nodejs/README.md delete mode 100644 modules/platforms/nodejs/api_spec/conf.json delete mode 100644 modules/platforms/nodejs/examples/AuthTlsExample.js delete mode 100644 modules/platforms/nodejs/examples/CachePutGetExample.js delete mode 100644 modules/platforms/nodejs/examples/FailoverExample.js delete mode 100644 modules/platforms/nodejs/examples/SqlExample.js delete mode 100644 modules/platforms/nodejs/examples/SqlQueryEntriesExample.js delete mode 100644 modules/platforms/nodejs/examples/certs/ca.crt delete mode 100644 modules/platforms/nodejs/examples/certs/client.crt delete mode 100644 modules/platforms/nodejs/examples/certs/client.key delete mode 100644 modules/platforms/nodejs/examples/certs/keystore.jks delete mode 100644 modules/platforms/nodejs/examples/certs/truststore.jks delete mode 100644 modules/platforms/nodejs/index.js delete mode 100644 modules/platforms/nodejs/lib/BinaryObject.js delete mode 100644 modules/platforms/nodejs/lib/CacheClient.js delete mode 100644 modules/platforms/nodejs/lib/CacheConfiguration.js delete mode 100644 modules/platforms/nodejs/lib/Cursor.js delete mode 100644 modules/platforms/nodejs/lib/EnumItem.js delete mode 100644 modules/platforms/nodejs/lib/Errors.js delete mode 100644 modules/platforms/nodejs/lib/IgniteClient.js delete mode 100644 modules/platforms/nodejs/lib/IgniteClientConfiguration.js delete mode 100644 modules/platforms/nodejs/lib/ObjectType.js delete mode 100644 modules/platforms/nodejs/lib/Query.js delete mode 100644 modules/platforms/nodejs/lib/Timestamp.js delete mode 100644 modules/platforms/nodejs/lib/internal/ArgumentChecker.js delete mode 100644 modules/platforms/nodejs/lib/internal/BinaryCommunicator.js delete mode 100644 modules/platforms/nodejs/lib/internal/BinaryType.js delete mode 100644 modules/platforms/nodejs/lib/internal/BinaryTypeStorage.js delete mode 100644 modules/platforms/nodejs/lib/internal/BinaryUtils.js delete mode 100644 modules/platforms/nodejs/lib/internal/ClientFailoverSocket.js delete mode 100644 modules/platforms/nodejs/lib/internal/ClientSocket.js delete mode 100644 modules/platforms/nodejs/lib/internal/Logger.js delete mode 100644 modules/platforms/nodejs/lib/internal/MessageBuffer.js delete mode 100644 modules/platforms/nodejs/package.json delete mode 100644 modules/platforms/nodejs/spec/ExamplesExecutor.js delete mode 100644 modules/platforms/nodejs/spec/TestingHelper.js delete mode 100644 modules/platforms/nodejs/spec/cache/BinaryObject.spec.js delete mode 100644 modules/platforms/nodejs/spec/cache/Cache.spec.js delete mode 100644 modules/platforms/nodejs/spec/cache/CacheKeyValueOps.spec.js delete mode 100644 modules/platforms/nodejs/spec/cache/CachePutGetDiffTypes.spec.js delete mode 100644 modules/platforms/nodejs/spec/cache/ComplexObject.spec.js delete mode 100644 modules/platforms/nodejs/spec/cache/UUID.spec.js delete mode 100644 modules/platforms/nodejs/spec/config.js delete mode 100644 modules/platforms/nodejs/spec/examples/AuthExample.spec.js delete mode 100644 modules/platforms/nodejs/spec/examples/Examples.spec.js delete mode 100644 modules/platforms/nodejs/spec/query/ScanQuery.spec.js delete mode 100644 modules/platforms/nodejs/spec/query/SqlFieldsQuery.spec.js delete mode 100644 modules/platforms/nodejs/spec/query/SqlQuery.spec.js delete mode 100644 modules/platforms/nodejs/spec/support/jasmine.json delete mode 100644 modules/platforms/php/.gitignore delete mode 100644 modules/platforms/php/README.md delete mode 100644 modules/platforms/php/api_docs/Doxyfile delete mode 100644 modules/platforms/php/composer.json delete mode 100644 modules/platforms/php/examples/AuthTlsExample.php delete mode 100644 modules/platforms/php/examples/CachePutGetExample.php delete mode 100644 modules/platforms/php/examples/FailoverExample.php delete mode 100644 modules/platforms/php/examples/SqlExample.php delete mode 100644 modules/platforms/php/examples/SqlQueryEntriesExample.php delete mode 100644 modules/platforms/php/examples/certs/ca.pem delete mode 100644 modules/platforms/php/examples/certs/client.pem delete mode 100644 modules/platforms/php/examples/certs/keystore.jks delete mode 100644 modules/platforms/php/examples/certs/truststore.jks delete mode 100644 modules/platforms/php/src/Apache/Ignite/Cache/CacheConfiguration.php delete mode 100644 modules/platforms/php/src/Apache/Ignite/Cache/CacheEntry.php delete mode 100644 modules/platforms/php/src/Apache/Ignite/Cache/CacheInterface.php delete mode 100644 modules/platforms/php/src/Apache/Ignite/Cache/CacheKeyConfiguration.php delete mode 100644 modules/platforms/php/src/Apache/Ignite/Cache/QueryEntity.php delete mode 100644 modules/platforms/php/src/Apache/Ignite/Cache/QueryField.php delete mode 100644 modules/platforms/php/src/Apache/Ignite/Cache/QueryIndex.php delete mode 100644 modules/platforms/php/src/Apache/Ignite/Client.php delete mode 100644 modules/platforms/php/src/Apache/Ignite/ClientConfiguration.php delete mode 100644 modules/platforms/php/src/Apache/Ignite/Data/BinaryObject.php delete mode 100644 modules/platforms/php/src/Apache/Ignite/Data/Date.php delete mode 100644 modules/platforms/php/src/Apache/Ignite/Data/EnumItem.php delete mode 100644 modules/platforms/php/src/Apache/Ignite/Data/Time.php delete mode 100644 modules/platforms/php/src/Apache/Ignite/Data/Timestamp.php delete mode 100644 modules/platforms/php/src/Apache/Ignite/Exception/ClientException.php delete mode 100644 modules/platforms/php/src/Apache/Ignite/Exception/NoConnectionException.php delete mode 100644 modules/platforms/php/src/Apache/Ignite/Exception/OperationException.php delete mode 100644 modules/platforms/php/src/Apache/Ignite/Exception/OperationStatusUnknownException.php delete mode 100644 modules/platforms/php/src/Apache/Ignite/Internal/Binary/BinaryCommunicator.php delete mode 100644 modules/platforms/php/src/Apache/Ignite/Internal/Binary/BinaryField.php delete mode 100644 modules/platforms/php/src/Apache/Ignite/Internal/Binary/BinaryObjectField.php delete mode 100644 modules/platforms/php/src/Apache/Ignite/Internal/Binary/BinarySchema.php delete mode 100644 modules/platforms/php/src/Apache/Ignite/Internal/Binary/BinaryType.php delete mode 100644 modules/platforms/php/src/Apache/Ignite/Internal/Binary/BinaryTypeBuilder.php delete mode 100644 modules/platforms/php/src/Apache/Ignite/Internal/Binary/BinaryTypeStorage.php delete mode 100644 modules/platforms/php/src/Apache/Ignite/Internal/Binary/BinaryUtils.php delete mode 100644 modules/platforms/php/src/Apache/Ignite/Internal/Binary/ClientOperation.php delete mode 100644 modules/platforms/php/src/Apache/Ignite/Internal/Binary/MessageBuffer.php delete mode 100644 modules/platforms/php/src/Apache/Ignite/Internal/Binary/Request.php delete mode 100644 modules/platforms/php/src/Apache/Ignite/Internal/Binary/TypeInfo.php delete mode 100644 modules/platforms/php/src/Apache/Ignite/Internal/Cache.php delete mode 100644 modules/platforms/php/src/Apache/Ignite/Internal/Connection/ClientFailoverSocket.php delete mode 100644 modules/platforms/php/src/Apache/Ignite/Internal/Connection/ClientSocket.php delete mode 100644 modules/platforms/php/src/Apache/Ignite/Internal/Connection/ProtocolVersion.php delete mode 100644 modules/platforms/php/src/Apache/Ignite/Internal/Query/Cursor.php delete mode 100644 modules/platforms/php/src/Apache/Ignite/Internal/Query/SqlFieldsCursor.php delete mode 100644 modules/platforms/php/src/Apache/Ignite/Internal/Utils/ArgumentChecker.php delete mode 100644 modules/platforms/php/src/Apache/Ignite/Internal/Utils/Logger.php delete mode 100644 modules/platforms/php/src/Apache/Ignite/Query/CursorInterface.php delete mode 100644 modules/platforms/php/src/Apache/Ignite/Query/Query.php delete mode 100644 modules/platforms/php/src/Apache/Ignite/Query/ScanQuery.php delete mode 100644 modules/platforms/php/src/Apache/Ignite/Query/SqlFieldsCursorInterface.php delete mode 100644 modules/platforms/php/src/Apache/Ignite/Query/SqlFieldsQuery.php delete mode 100644 modules/platforms/php/src/Apache/Ignite/Query/SqlQuery.php delete mode 100644 modules/platforms/php/src/Apache/Ignite/Type/CollectionObjectType.php delete mode 100644 modules/platforms/php/src/Apache/Ignite/Type/ComplexObjectType.php delete mode 100644 modules/platforms/php/src/Apache/Ignite/Type/MapObjectType.php delete mode 100644 modules/platforms/php/src/Apache/Ignite/Type/ObjectArrayType.php delete mode 100644 modules/platforms/php/src/Apache/Ignite/Type/ObjectType.php delete mode 100644 modules/platforms/php/tests/BinaryObjectTest.php delete mode 100644 modules/platforms/php/tests/CacheKeyValueOpsTest.php delete mode 100644 modules/platforms/php/tests/CachePutGetTest.php delete mode 100644 modules/platforms/php/tests/CacheTest.php delete mode 100644 modules/platforms/php/tests/ComplexObjectTest.php delete mode 100644 modules/platforms/php/tests/ScanQueryTest.php delete mode 100644 modules/platforms/php/tests/SqlFieldsQueryTest.php delete mode 100644 modules/platforms/php/tests/SqlQueryTest.php delete mode 100644 modules/platforms/php/tests/TestConfig.php delete mode 100644 modules/platforms/php/tests/TestingHelper.php delete mode 100644 modules/platforms/php/tests/examples/ExecuteAuthTlsExample.php delete mode 100644 modules/platforms/php/tests/examples/ExecuteExamples.php delete mode 100644 modules/platforms/python/LICENSE delete mode 100644 modules/platforms/python/README.md delete mode 100644 modules/platforms/python/docs/Makefile delete mode 100644 modules/platforms/python/docs/conf.py delete mode 100644 modules/platforms/python/docs/datatypes/cache_props.rst delete mode 100644 modules/platforms/python/docs/datatypes/parsers.rst delete mode 100644 modules/platforms/python/docs/examples.rst delete mode 100644 modules/platforms/python/docs/index.rst delete mode 100644 modules/platforms/python/docs/modules.rst delete mode 100644 modules/platforms/python/docs/readme.rst delete mode 100644 modules/platforms/python/docs/source/modules.rst delete mode 100644 modules/platforms/python/docs/source/pyignite.api.binary.rst delete mode 100644 modules/platforms/python/docs/source/pyignite.api.cache_config.rst delete mode 100644 modules/platforms/python/docs/source/pyignite.api.key_value.rst delete mode 100644 modules/platforms/python/docs/source/pyignite.api.result.rst delete mode 100644 modules/platforms/python/docs/source/pyignite.api.rst delete mode 100644 modules/platforms/python/docs/source/pyignite.api.sql.rst delete mode 100644 modules/platforms/python/docs/source/pyignite.binary.rst delete mode 100644 modules/platforms/python/docs/source/pyignite.cache.rst delete mode 100644 modules/platforms/python/docs/source/pyignite.client.rst delete mode 100644 modules/platforms/python/docs/source/pyignite.connection.generators.rst delete mode 100644 modules/platforms/python/docs/source/pyignite.connection.handshake.rst delete mode 100644 modules/platforms/python/docs/source/pyignite.connection.rst delete mode 100644 modules/platforms/python/docs/source/pyignite.connection.ssl.rst delete mode 100644 modules/platforms/python/docs/source/pyignite.constants.rst delete mode 100644 modules/platforms/python/docs/source/pyignite.datatypes.base.rst delete mode 100644 modules/platforms/python/docs/source/pyignite.datatypes.binary.rst delete mode 100644 modules/platforms/python/docs/source/pyignite.datatypes.cache_config.rst delete mode 100644 modules/platforms/python/docs/source/pyignite.datatypes.cache_properties.rst delete mode 100644 modules/platforms/python/docs/source/pyignite.datatypes.complex.rst delete mode 100644 modules/platforms/python/docs/source/pyignite.datatypes.internal.rst delete mode 100644 modules/platforms/python/docs/source/pyignite.datatypes.key_value.rst delete mode 100644 modules/platforms/python/docs/source/pyignite.datatypes.null_object.rst delete mode 100644 modules/platforms/python/docs/source/pyignite.datatypes.primitive.rst delete mode 100644 modules/platforms/python/docs/source/pyignite.datatypes.primitive_arrays.rst delete mode 100644 modules/platforms/python/docs/source/pyignite.datatypes.primitive_objects.rst delete mode 100644 modules/platforms/python/docs/source/pyignite.datatypes.prop_codes.rst delete mode 100644 modules/platforms/python/docs/source/pyignite.datatypes.rst delete mode 100644 modules/platforms/python/docs/source/pyignite.datatypes.sql.rst delete mode 100644 modules/platforms/python/docs/source/pyignite.datatypes.standard.rst delete mode 100644 modules/platforms/python/docs/source/pyignite.datatypes.type_codes.rst delete mode 100644 modules/platforms/python/docs/source/pyignite.exceptions.rst delete mode 100644 modules/platforms/python/docs/source/pyignite.queries.op_codes.rst delete mode 100644 modules/platforms/python/docs/source/pyignite.queries.rst delete mode 100644 modules/platforms/python/docs/source/pyignite.rst delete mode 100644 modules/platforms/python/docs/source/pyignite.utils.rst delete mode 100644 modules/platforms/python/examples/binary_basics.py delete mode 100644 modules/platforms/python/examples/create_binary.py delete mode 100644 modules/platforms/python/examples/failover.py delete mode 100644 modules/platforms/python/examples/get_and_put.py delete mode 100644 modules/platforms/python/examples/migrate_binary.py delete mode 100644 modules/platforms/python/examples/read_binary.py delete mode 100644 modules/platforms/python/examples/readme.md delete mode 100644 modules/platforms/python/examples/scans.py delete mode 100644 modules/platforms/python/examples/sql.py delete mode 100644 modules/platforms/python/examples/type_hints.py delete mode 100644 modules/platforms/python/pyignite/__init__.py delete mode 100644 modules/platforms/python/pyignite/api/__init__.py delete mode 100644 modules/platforms/python/pyignite/api/binary.py delete mode 100644 modules/platforms/python/pyignite/api/cache_config.py delete mode 100644 modules/platforms/python/pyignite/api/key_value.py delete mode 100644 modules/platforms/python/pyignite/api/result.py delete mode 100644 modules/platforms/python/pyignite/api/sql.py delete mode 100644 modules/platforms/python/pyignite/binary.py delete mode 100644 modules/platforms/python/pyignite/cache.py delete mode 100644 modules/platforms/python/pyignite/client.py delete mode 100644 modules/platforms/python/pyignite/connection/__init__.py delete mode 100644 modules/platforms/python/pyignite/connection/generators.py delete mode 100644 modules/platforms/python/pyignite/connection/handshake.py delete mode 100644 modules/platforms/python/pyignite/connection/ssl.py delete mode 100644 modules/platforms/python/pyignite/constants.py delete mode 100644 modules/platforms/python/pyignite/datatypes/__init__.py delete mode 100644 modules/platforms/python/pyignite/datatypes/base.py delete mode 100644 modules/platforms/python/pyignite/datatypes/binary.py delete mode 100644 modules/platforms/python/pyignite/datatypes/cache_config.py delete mode 100644 modules/platforms/python/pyignite/datatypes/cache_properties.py delete mode 100644 modules/platforms/python/pyignite/datatypes/complex.py delete mode 100644 modules/platforms/python/pyignite/datatypes/internal.py delete mode 100644 modules/platforms/python/pyignite/datatypes/key_value.py delete mode 100644 modules/platforms/python/pyignite/datatypes/null_object.py delete mode 100644 modules/platforms/python/pyignite/datatypes/primitive.py delete mode 100644 modules/platforms/python/pyignite/datatypes/primitive_arrays.py delete mode 100644 modules/platforms/python/pyignite/datatypes/primitive_objects.py delete mode 100644 modules/platforms/python/pyignite/datatypes/prop_codes.py delete mode 100644 modules/platforms/python/pyignite/datatypes/sql.py delete mode 100644 modules/platforms/python/pyignite/datatypes/standard.py delete mode 100644 modules/platforms/python/pyignite/datatypes/type_codes.py delete mode 100644 modules/platforms/python/pyignite/exceptions.py delete mode 100644 modules/platforms/python/pyignite/queries/__init__.py delete mode 100644 modules/platforms/python/pyignite/queries/op_codes.py delete mode 100644 modules/platforms/python/pyignite/utils.py delete mode 100644 modules/platforms/python/requirements/docs.txt delete mode 100644 modules/platforms/python/requirements/install.txt delete mode 100644 modules/platforms/python/requirements/setup.txt delete mode 100644 modules/platforms/python/requirements/tests.txt delete mode 100644 modules/platforms/python/setup.py delete mode 100644 modules/platforms/python/tests/config/ssl.xml delete mode 100644 modules/platforms/python/tests/config/ssl/README.txt delete mode 100644 modules/platforms/python/tests/config/ssl/client_full.pem delete mode 100644 modules/platforms/python/tests/config/ssl/client_with_pass_full.pem delete mode 100644 modules/platforms/python/tests/config/ssl/server.jks delete mode 100644 modules/platforms/python/tests/config/ssl/trust.jks delete mode 100644 modules/platforms/python/tests/conftest.py delete mode 100644 modules/platforms/python/tests/test_binary.py delete mode 100644 modules/platforms/python/tests/test_cache_class.py delete mode 100644 modules/platforms/python/tests/test_cache_class_sql.py delete mode 100644 modules/platforms/python/tests/test_cache_config.py delete mode 100644 modules/platforms/python/tests/test_datatypes.py delete mode 100644 modules/platforms/python/tests/test_examples.py delete mode 100644 modules/platforms/python/tests/test_generic_object.py delete mode 100644 modules/platforms/python/tests/test_get_names.py delete mode 100644 modules/platforms/python/tests/test_handshake.py delete mode 100644 modules/platforms/python/tests/test_key_value.py delete mode 100644 modules/platforms/python/tests/test_scan.py delete mode 100644 modules/platforms/python/tests/test_sql.py diff --git a/README.txt b/README.txt index c7a2cdfab288d..de1385a030587 100644 --- a/README.txt +++ b/README.txt @@ -52,9 +52,6 @@ for Transparent Data Encryption of data on disk and for AWS S3 Client Side Encryprion. (https://java.sun.com/javase/technologies/security/) -* Python client uses Python's SSL lib (https://docs.python.org/3/library/ssl.html) which is a wrapper over OpenSSL; -* NodeJS client uses NodeJS's TLS module (https://nodejs.org/api/tls.html) which is a wrapper over OpenSSL; -* PHP client uses PHP OpenSSL extension (https://www.php.net/manual/en/book.openssl.php); * C++ thin client and ODBC use OpenSSL to establish secure connection with the cluster. The OpenSSL Project (https://www.openssl.org/) diff --git a/assembly/release-apache-ignite-base.xml b/assembly/release-apache-ignite-base.xml index 834d782cab9ec..27294b5b3d3ee 100644 --- a/assembly/release-apache-ignite-base.xml +++ b/assembly/release-apache-ignite-base.xml @@ -41,44 +41,6 @@ CMakeLists.txt - - - modules/platforms/nodejs/index.js - /platforms/nodejs - - - - modules/platforms/nodejs/package.json - /platforms/nodejs - - - - modules/platforms/nodejs/README.md - /platforms/nodejs - - - - - modules/platforms/php/composer.json - /platforms/php - - - - - modules/platforms/python/LICENSE - /platforms/python - - - - modules/platforms/python/README.md - /platforms/python - - - - modules/platforms/python/setup.py - /platforms/python - - assembly/LICENSE_IGNITE @@ -224,44 +186,6 @@ /platforms/cpp/bin - - - modules/platforms/nodejs/lib - /platforms/nodejs/lib - - - - modules/platforms/nodejs/examples - /platforms/nodejs/examples - - - - - modules/platforms/php/src - /platforms/php/src - - - - modules/platforms/php/examples - /platforms/php/examples - - - - - modules/platforms/python/pyignite - /platforms/python/pyignite - - - - modules/platforms/python/requirements - /platforms/python/requirements - - - - modules/platforms/python/examples - /platforms/python/examples - - bin diff --git a/docs/_docs/quick-start/nodejs.adoc b/docs/_docs/quick-start/nodejs.adoc index 355c9580d47d3..1e1a3391f9b38 100644 --- a/docs/_docs/quick-start/nodejs.adoc +++ b/docs/_docs/quick-start/nodejs.adoc @@ -51,11 +51,11 @@ include::includes/starting-node.adoc[] Once the cluster is started, you can use the Ignite Node.js thin client to perform cache operations. -Your Ignite installation includes several ready-to-run Node.JS examples in the `{ignite_nodejs_dir}/platforms/nodejs/examples` directory. For example, +Your Ignite installation includes several ready-to-run Node.JS examples in the `{client_dir}/examples` directory. For example, [source,shell] ---- -cd {IGNITE_HOME}/platforms/nodejs/examples +cd {client_dir}/examples node CachePutGetExample.js ---- @@ -100,5 +100,5 @@ performCacheKeyValueOperations(); From here, you may want to: * Read more about using Ignite Node.js Thin Client link:thin-clients/nodejs-thin-client[here] -//* Explore the link:https://github.com/gridgain/nodejs-thin-client/tree/master/examples[additional examples] included with Ignite +* Explore the link:https://github.com/apache/ignite-nodejs-thin-client/tree/master/examples[additional examples] diff --git a/docs/_docs/quick-start/php.adoc b/docs/_docs/quick-start/php.adoc index ec8a6eb0c5e32..12314d224229f 100644 --- a/docs/_docs/quick-start/php.adoc +++ b/docs/_docs/quick-start/php.adoc @@ -38,12 +38,9 @@ and: include::includes/install-ignite.adoc[] -Once that's done, go to `{IGNITE_HOME}/platforms/php` and install Ignite PHP Thin Client as a Composer package using the command below: +Once that's done, install PHP Thin Client as a Composer package using the command below: -[source, ruby] ----- -composer install --no-dev ----- +include::includes/install-php-composer.adoc[] You're almost ready to run your first application. @@ -56,7 +53,8 @@ include::includes/starting-node.adoc[] == Running Your First Application Once at least one node is started, you can use the Ignite PHP thin client to perform cache operations. -Your Ignite installation includes several ready-to-run PHP examples in the `{IGNITE_HOME}/platforms/php/examples` directory. For example, +Your Ignite installation includes several ready-to-run PHP examples in the `{client_dir}/examples` directory. +Here is example how to run one of them: [tabs] @@ -64,14 +62,13 @@ Your Ignite installation includes several ready-to-run PHP examples in the `{IGN tab:Unix[] [source,shell] ---- -cd {IGNITE_HOME}/platforms/php/examples +cd {client_dir}/examples php CachePutGetExample.php ---- - tab:Windows[] [source,shell] ---- -cd {IGNITE_HOME}\platforms\php\examples +cd {client_dir}\examples php CachePutGetExample.php ---- -- @@ -121,5 +118,5 @@ performCacheKeyValueOperations(); From here, you may want to: * Read more about using link:thin-clients/php-thin-client[PHP Thin Client] -//* Explore the link:https://github.com/gridgain/php-thin-client/tree/master/examples[additional examples] included with GridGain +* Explore the link:https://github.com/apache/ignite-php-thin-client/tree/master/examples[additional examples] included with GridGain diff --git a/docs/_docs/quick-start/python.adoc b/docs/_docs/quick-start/python.adoc index ef96e7cc4bc5b..c77fd76b72c99 100644 --- a/docs/_docs/quick-start/python.adoc +++ b/docs/_docs/quick-start/python.adoc @@ -85,4 +85,4 @@ Or you can enter the example into your Python interpreter/shell (IDLE on Windows == Further Examples -Explore more Ignite Python examples link:{githubUrl}/modules/platforms/python/examples[here^]. +Explore more Ignite Python examples link:https://github.com/apache/ignite-python-thin-client/tree/master/examples[here^]. diff --git a/docs/_docs/thin-clients/nodejs-thin-client.adoc b/docs/_docs/thin-clients/nodejs-thin-client.adoc index 67ad09a14d4c1..4f7d9bc3bb4a2 100644 --- a/docs/_docs/thin-clients/nodejs-thin-client.adoc +++ b/docs/_docs/thin-clients/nodejs-thin-client.adoc @@ -39,8 +39,8 @@ npm install -g apache-ignite-client The thin client can be installed from the zip archive available for download from the Ignite website: -* Download the link:https://ignite.apache.org/download.cgi#binaries[Apache Ignite binary package,window=_blank]. -* Unpack the archive and navigate to the `{IGNITE_HOME}/platforms/nodejs` folder. +* Download the link:https://ignite.apache.org/download.cgi#binaries[Apache Ignite Node.js Thin Client,window=_blank]. +* Unpack the archive and navigate to the root folder. * Run the commands below to finish the installation. [source,shell] diff --git a/docs/_docs/thin-clients/php-thin-client.adoc b/docs/_docs/thin-clients/php-thin-client.adoc index 819a5e9337838..3b99ad54f6e37 100644 --- a/docs/_docs/thin-clients/php-thin-client.adoc +++ b/docs/_docs/thin-clients/php-thin-client.adoc @@ -22,10 +22,18 @@ Depending on your PHP configuration, you may need to additionally install/config == Installation -The thin client can be installed from the zip archive: +The PHP thin client is shipped as a Composer package and a zip archive. Use any of the methods to install the client in your environment. -* Download the link:https://ignite.apache.org/download.cgi#binaries[Apache Ignite binary package,window=_blank]. -* Unpack the archive and navigate to the `{IGNITE_HOME}/platforms/php` folder. +=== Using Composer + +include::includes/install-php-composer.adoc[] + +=== Using ZIP Archive + +The thin client can be installed from the zip archive available for download from the Apache Ignite website: + +* Download the link:https://ignite.apache.org/download.cgi#binaries[Apache Ignite PHP Thin Client,window=_blank]. +* Unpack the archive and navigate to the root folder. * Use the command below to install the package. [source,shell] diff --git a/docs/_docs/thin-clients/python-thin-client.adoc b/docs/_docs/thin-clients/python-thin-client.adoc index f04a567f24088..4bbbd8c584f9c 100644 --- a/docs/_docs/thin-clients/python-thin-client.adoc +++ b/docs/_docs/thin-clients/python-thin-client.adoc @@ -32,9 +32,9 @@ include::includes/install-python-pip.adoc[] === Using ZIP Archive -The thin client can be installed from the zip archive: +The thin client can be installed from the zip archive available for download from the Apache Ignite website: -* Download the link:https://ignite.apache.org/download.cgi#binaries[Apache Ignite binary package,window=_blank]. +* Download the link:https://ignite.apache.org/download.cgi#binaries[Apache Ignite Python Thin Client,window=_blank]. * Unpack the archive and navigate to the root folder. * Install the client using the command below. @@ -78,8 +78,8 @@ Refer to the https://setuptools.readthedocs.io/en/latest/[Setuptools manual] for == Connecting to Cluster -The distribution package contains runnable examples that demonstrate basic usage scenarios of the Python thin client. -The examples are located in the `{ROOT_FOLDER}/examples` directory. +The ZIP distribution package contains runnable examples that demonstrate basic usage scenarios of the Python thin client. +The examples are located in the `{client_dir}/examples` directory. The following code snippet shows how to connect to a cluster from the Python thin client: diff --git a/modules/platforms/nodejs/README.md b/modules/platforms/nodejs/README.md deleted file mode 100644 index 4792caa5b0a69..0000000000000 --- a/modules/platforms/nodejs/README.md +++ /dev/null @@ -1,32 +0,0 @@ -# NodeJS Client for Apache Ignite # - -## Installation ## - -[Node.js](https://nodejs.org/en/) version 8 or higher is required. Either download the Node.js [pre-built binary](https://nodejs.org/en/download/) for the target platform, or install Node.js via [package manager](https://nodejs.org/en/download/package-manager). - -Once `node` and `npm` are installed, you can use one of the following installation options. - -### Installation via npm ### - -Execute the following command to install the Node.js Thin Client package: - -``` -npm install -g apache-ignite-client -``` - -### Installation from Sources ### - -If you want to install the Thin Client library from Ignite sources, please follow the steps: - -1. Download Ignite sources to `local_ignite_path` -2. Go to `local_ignite_path/modules/platforms/nodejs` folder -3. Execute `npm link` command -4. Execute `npm link apache-ignite-client` command (needed only for examples) - -```bash -cd local_ignite_path/modules/platforms/nodejs -npm link -npm link apache-ignite-client #linking examples (optional) -``` - -For more information, see [Apache Ignite Node.JS Thin Client documentation](https://apacheignite.readme.io/docs/nodejs-thin-client). diff --git a/modules/platforms/nodejs/api_spec/conf.json b/modules/platforms/nodejs/api_spec/conf.json deleted file mode 100644 index 1cc1db03e3683..0000000000000 --- a/modules/platforms/nodejs/api_spec/conf.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "plugins": [ - "plugins/markdown" - ], - "source": { - "include": [ "../lib" ], - "includePattern": ".+\\.js$" - }, - "opts": { - "destination": "." - } -} diff --git a/modules/platforms/nodejs/examples/AuthTlsExample.js b/modules/platforms/nodejs/examples/AuthTlsExample.js deleted file mode 100644 index b47df6194aa6a..0000000000000 --- a/modules/platforms/nodejs/examples/AuthTlsExample.js +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -const FS = require('fs'); -const IgniteClient = require('apache-ignite-client'); -const ObjectType = IgniteClient.ObjectType; -const ComplexObjectType = IgniteClient.ComplexObjectType; -const BinaryObject = IgniteClient.BinaryObject; -const CacheEntry = IgniteClient.CacheEntry; -const ScanQuery = IgniteClient.ScanQuery; -const IgniteClientConfiguration = IgniteClient.IgniteClientConfiguration; - -const ENDPOINT = 'localhost:10800'; -const USER_NAME = 'ignite'; -const PASSWORD = 'ignite'; - -const TLS_KEY_FILE_NAME = __dirname + '/certs/client.key'; -const TLS_CERT_FILE_NAME = __dirname + '/certs/client.crt'; -const TLS_CA_FILE_NAME = __dirname + '/certs/ca.crt'; - -const CACHE_NAME = 'AuthTlsExample_cache'; - -// This example demonstrates how to establish a secure connection to an Ignite node and use username/password authentication, -// as well as basic Key-Value Queries operations for primitive types: -// - connects to a node using TLS and providing username/password -// - creates a cache, if it doesn't exist -// - specifies key and value type of the cache -// - put data of primitive types into the cache -// - get data from the cache -// - destroys the cache -class AuthTlsExample { - - async start() { - const igniteClient = new IgniteClient(this.onStateChanged.bind(this)); - try { - const connectionOptions = { - 'key' : FS.readFileSync(TLS_KEY_FILE_NAME), - 'cert' : FS.readFileSync(TLS_CERT_FILE_NAME), - 'ca' : FS.readFileSync(TLS_CA_FILE_NAME) - }; - await igniteClient.connect(new IgniteClientConfiguration(ENDPOINT). - setUserName(USER_NAME). - setPassword(PASSWORD). - setConnectionOptions(true, connectionOptions)); - - const cache = (await igniteClient.getOrCreateCache(CACHE_NAME)). - setKeyType(ObjectType.PRIMITIVE_TYPE.INTEGER). - setValueType(ObjectType.PRIMITIVE_TYPE.SHORT_ARRAY); - - await this.putGetData(cache); - - await igniteClient.destroyCache(CACHE_NAME); - } - catch (err) { - console.log('ERROR: ' + err.message); - } - finally { - igniteClient.disconnect(); - } - } - - async putGetData(cache) { - let keys = [1, 2, 3]; - let values = keys.map(key => this.generateValue(key)); - - // put multiple values in parallel - await Promise.all([ - await cache.put(keys[0], values[0]), - await cache.put(keys[1], values[1]), - await cache.put(keys[2], values[2]) - ]); - console.log('Cache values put successfully'); - - // get values sequentially - let value; - for (let i = 0; i < keys.length; i++) { - value = await cache.get(keys[i]); - if (!this.compareValues(value, values[i])) { - console.log('Unexpected cache value!'); - return; - } - } - console.log('Cache values get successfully'); - } - - compareValues(array1, array2) { - return array1.length === array2.length && - array1.every((value1, index) => value1 === array2[index]); - } - - generateValue(key) { - const length = key + 5; - const result = new Array(length); - for (let i = 0; i < length; i++) { - result[i] = key * 10 + i; - } - return result; - } - - onStateChanged(state, reason) { - if (state === IgniteClient.STATE.CONNECTED) { - console.log('Client is started'); - } - else if (state === IgniteClient.STATE.DISCONNECTED) { - console.log('Client is stopped'); - if (reason) { - console.log(reason); - } - } - } -} - -const authTlsExample = new AuthTlsExample(); -authTlsExample.start(); diff --git a/modules/platforms/nodejs/examples/CachePutGetExample.js b/modules/platforms/nodejs/examples/CachePutGetExample.js deleted file mode 100644 index b37f573936540..0000000000000 --- a/modules/platforms/nodejs/examples/CachePutGetExample.js +++ /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. - */ - -const IgniteClient = require('apache-ignite-client'); -const ObjectType = IgniteClient.ObjectType; -const ComplexObjectType = IgniteClient.ComplexObjectType; -const BinaryObject = IgniteClient.BinaryObject; -const CacheEntry = IgniteClient.CacheEntry; -const ScanQuery = IgniteClient.ScanQuery; -const IgniteClientConfiguration = IgniteClient.IgniteClientConfiguration; - -const ENDPOINT = '127.0.0.1:10800'; - -const CACHE_NAME = 'CachePutGetExample_person'; -const PERSON_TYPE_NAME = 'Person'; - -class Person { - constructor(firstName = null, lastName = null, salary = null) { - this.id = Person.generateId(); - this.firstName = firstName; - this.lastName = lastName; - this.salary = salary; - } - - static generateId() { - if (!Person.id) { - Person.id = 0; - } - const id = Person.id; - Person.id++; - return id; - } -} - -// This example demonstrates basic Cache, Key-Value Queries and Scan Query operations: -// - connects to a node -// - creates a cache, if it doesn't exist -// - specifies key type as Integer -// - executes different cache operations with Complex Objects and Binary Objects -// - put several objects in parallel -// - putAll -// - get -// - getAll -// - ScanQuery -// - destroys the cache -class CachePutGetExample { - - constructor() { - this._personCache = null; - this._personObjectType = null; - this._binaryObjectCache = null; - } - - async start() { - const igniteClient = new IgniteClient(this.onStateChanged.bind(this)); - try { - await igniteClient.connect(new IgniteClientConfiguration(ENDPOINT)); - - this._personObjectType = new ComplexObjectType(new Person(), PERSON_TYPE_NAME). - setFieldType('id', ObjectType.PRIMITIVE_TYPE.INTEGER); - - this._personCache = (await igniteClient.getOrCreateCache(CACHE_NAME)). - setKeyType(ObjectType.PRIMITIVE_TYPE.INTEGER). - setValueType(this._personObjectType); - - this._binaryObjectCache = igniteClient.getCache(CACHE_NAME). - setKeyType(ObjectType.PRIMITIVE_TYPE.INTEGER); - - await this.putComplexObjects(); - await this.putAllBinaryObjects(); - - await this.getAllComplexObjects(); - await this.getBinaryObjects(); - - await this.scanQuery(); - - await igniteClient.destroyCache(CACHE_NAME); - } - catch (err) { - console.log('ERROR: ' + err.message); - } - finally { - igniteClient.disconnect(); - } - } - - async putComplexObjects() { - const person1 = new Person('John', 'Doe', 1000); - const person2 = new Person('Jane', 'Roe', 2000); - - // put multiple values in parallel - await Promise.all([ - await this._personCache.put(person1.id, person1), - await this._personCache.put(person2.id, person2) - ]); - - console.log('Complex Objects put successfully'); - } - - async putAllBinaryObjects() { - // create binary object from scratch - const personBinaryObject1 = new BinaryObject(PERSON_TYPE_NAME). - setField('id', Person.generateId(), ObjectType.PRIMITIVE_TYPE.INTEGER). - setField('firstName', 'Mary'). - setField('lastName', 'Major'). - setField('salary', 1500); - - // create binary object from complex object - const personBinaryObject2 = await BinaryObject.fromObject( - new Person('Richard', 'Miles', 800), this._personObjectType); - - await this._binaryObjectCache.putAll([ - new CacheEntry(await personBinaryObject1.getField('id'), personBinaryObject1), - new CacheEntry(await personBinaryObject2.getField('id'), personBinaryObject2) - ]); - - console.log('Binary Objects put successfully using putAll()'); - } - - async getAllComplexObjects() { - const persons = await this._personCache.getAll([2, 3]); - console.log('Complex Objects getAll:'); - for (let person of persons) { - this.printPersonObject(person.getValue()); - } - } - - async getBinaryObjects() { - const personBinaryObject = await this._binaryObjectCache.get(3); - console.log('Binary Object get:'); - console.log(' ' + personBinaryObject.getTypeName()); - let fieldValue; - for (let fieldName of personBinaryObject.getFieldNames()) { - fieldValue = await personBinaryObject.getField(fieldName); - this.printPersonField(fieldName, fieldValue); - } - } - - async scanQuery() { - const cursor = await this._personCache.query(new ScanQuery()); - console.log('Scan query results:'); - for (let cacheEntry of await cursor.getAll()) { - this.printPersonObject(cacheEntry.getValue()); - } - } - - onStateChanged(state, reason) { - if (state === IgniteClient.STATE.CONNECTED) { - console.log('Client is started'); - } - else if (state === IgniteClient.STATE.DISCONNECTED) { - console.log('Client is stopped'); - if (reason) { - console.log(reason); - } - } - } - - printPersonObject(person) { - console.log(' ' + PERSON_TYPE_NAME); - for (let key in person) { - this.printPersonField(key, person[key]); - } - } - - printPersonField(fieldName, fieldValue) { - console.log(' ' + fieldName + ' : ' + fieldValue); - } -} - -const cachePutGetExample = new CachePutGetExample(); -cachePutGetExample.start(); diff --git a/modules/platforms/nodejs/examples/FailoverExample.js b/modules/platforms/nodejs/examples/FailoverExample.js deleted file mode 100644 index 25db544114bd7..0000000000000 --- a/modules/platforms/nodejs/examples/FailoverExample.js +++ /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. - */ - -const IgniteClient = require('apache-ignite-client'); -const IgniteClientConfiguration = IgniteClient.IgniteClientConfiguration; - -const ENDPOINT1 = 'localhost:10800'; -const ENDPOINT2 = 'localhost:10801'; -const ENDPOINT3 = 'localhost:10802'; - -// This example demonstrates failover behavior of the client -// - configures the client to connect to a set of nodes -// - connects to a node -// - if connection is broken, the client automatically tries to reconnect to another node -// - if no specified nodes are available, stops the client -async function connectClient() { - const igniteClient = new IgniteClient(onStateChanged); - igniteClient.setDebug(true); - try { - const igniteClientConfiguration = new IgniteClientConfiguration( - ENDPOINT1, ENDPOINT2, ENDPOINT3); - // connect to Ignite a node - await igniteClient.connect(igniteClientConfiguration); - } - catch (err) { - console.log(err.message); - } -} - -function onStateChanged(state, reason) { - if (state === IgniteClient.STATE.CONNECTED) { - console.log('Client is started'); - } - else if (state === IgniteClient.STATE.CONNECTING) { - console.log('Client is connecting'); - } - else if (state === IgniteClient.STATE.DISCONNECTED) { - console.log('Client is stopped'); - if (reason) { - console.log(reason); - } - } -} - -connectClient(); \ No newline at end of file diff --git a/modules/platforms/nodejs/examples/SqlExample.js b/modules/platforms/nodejs/examples/SqlExample.js deleted file mode 100644 index 92f59d7cc8ad3..0000000000000 --- a/modules/platforms/nodejs/examples/SqlExample.js +++ /dev/null @@ -1,242 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -const Util = require('util'); -const IgniteClient = require('apache-ignite-client'); -const ObjectType = IgniteClient.ObjectType; -const IgniteClientConfiguration = IgniteClient.IgniteClientConfiguration; -const CacheConfiguration = IgniteClient.CacheConfiguration; -const SqlFieldsQuery = IgniteClient.SqlFieldsQuery; -const SqlQuery = IgniteClient.SqlQuery; - -const ENDPOINT = '127.0.0.1:10800'; - -const COUNTRY_CACHE_NAME = 'Country'; -const CITY_CACHE_NAME = 'City'; -const COUNTRY_LANGUAGE_CACHE_NAME = 'CountryLng'; -const DUMMY_CACHE_NAME = 'SqlExample_Dummy'; - -// This example shows primary APIs to use with Ignite as with an SQL database: -// - connects to a node -// - creates a cache, if it doesn't exist -// - creates tables (CREATE TABLE) -// - creates indices (CREATE INDEX) -// - writes data of primitive types into the tables (INSERT INTO table) -// - reads data from the tables (SELECT ...) -// - deletes tables (DROP TABLE) -// - destroys the cache -class SqlExample { - async start() { - const igniteClient = new IgniteClient(this.onStateChanged.bind(this)); - try { - await igniteClient.connect(new IgniteClientConfiguration(ENDPOINT)); - - const cache = await igniteClient.getOrCreateCache( - DUMMY_CACHE_NAME, - new CacheConfiguration().setSqlSchema('PUBLIC')); - - await this.createDatabaseObjects(cache); - await this.insertData(cache); - - const countryCache = igniteClient.getCache(COUNTRY_CACHE_NAME); - const cityCache = igniteClient.getCache(CITY_CACHE_NAME); - - await this.getMostPopulatedCities(countryCache); - await this.getTopCitiesInThreeCountries(cityCache); - await this.getCityDetails(cityCache, 5); - - await this.deleteDatabaseObjects(cache); - await igniteClient.destroyCache(DUMMY_CACHE_NAME); - } - catch (err) { - console.log('ERROR: ' + err.message); - } - finally { - igniteClient.disconnect(); - } - } - - async createDatabaseObjects(cache) { - const createCountryTable = `CREATE TABLE Country ( - Code CHAR(3) PRIMARY KEY, - Name CHAR(52), - Continent CHAR(50), - Region CHAR(26), - SurfaceArea DECIMAL(10,2), - IndepYear SMALLINT(6), - Population INT(11), - LifeExpectancy DECIMAL(3,1), - GNP DECIMAL(10,2), - GNPOld DECIMAL(10,2), - LocalName CHAR(45), - GovernmentForm CHAR(45), - HeadOfState CHAR(60), - Capital INT(11), - Code2 CHAR(2) - ) WITH "template=partitioned, backups=1, CACHE_NAME=${COUNTRY_CACHE_NAME}"`; - - const createCityTable = `CREATE TABLE City ( - ID INT(11), - Name CHAR(35), - CountryCode CHAR(3), - District CHAR(20), - Population INT(11), - PRIMARY KEY (ID, CountryCode) - ) WITH "template=partitioned, backups=1, affinityKey=CountryCode, CACHE_NAME=${CITY_CACHE_NAME}"`; - - const createCountryLanguageTable = `CREATE TABLE CountryLanguage ( - CountryCode CHAR(3), - Language CHAR(30), - IsOfficial CHAR(2), - Percentage DECIMAL(4,1), - PRIMARY KEY (CountryCode, Language) - ) WITH "template=partitioned, backups=1, affinityKey=CountryCode, CACHE_NAME=${COUNTRY_LANGUAGE_CACHE_NAME}"`; - - // create tables - (await cache.query(new SqlFieldsQuery(createCountryTable))).getAll(); - (await cache.query(new SqlFieldsQuery(createCityTable))).getAll(); - (await cache.query(new SqlFieldsQuery(createCountryLanguageTable))).getAll(); - - // create indices - (await cache.query(new SqlFieldsQuery( - 'CREATE INDEX idx_country_code ON city (CountryCode)'))).getAll(); - (await cache.query(new SqlFieldsQuery( - 'CREATE INDEX idx_lang_country_code ON CountryLanguage (CountryCode)'))).getAll(); - - console.log('Database objects created'); - } - - async insertData(cache) { - const cities = [ - ['New York', 'USA', 'New York', 8008278], - ['Los Angeles', 'USA', 'California', 3694820], - ['Chicago', 'USA', 'Illinois', 2896016], - ['Houston', 'USA', 'Texas', 1953631], - ['Philadelphia', 'USA', 'Pennsylvania', 1517550], - ['Moscow', 'RUS', 'Moscow (City)', 8389200], - ['St Petersburg', 'RUS', 'Pietari', 4694000], - ['Novosibirsk', 'RUS', 'Novosibirsk', 1398800], - ['Nizni Novgorod', 'RUS', 'Nizni Novgorod', 1357000], - ['Jekaterinburg', 'RUS', 'Sverdlovsk', 1266300], - ['Shanghai', 'CHN', 'Shanghai', 9696300], - ['Peking', 'CHN', 'Peking', 7472000], - ['Chongqing', 'CHN', 'Chongqing', 6351600], - ['Tianjin', 'CHN', 'Tianjin', 5286800], - ['Wuhan', 'CHN', 'Hubei', 4344600] - ]; - - const cityQuery = new SqlFieldsQuery(`INSERT INTO City(ID, Name, CountryCode, District, Population) - VALUES (?, ?, ?, ?, ?)`); - - for (let i = 0; i < cities.length; i++) { - (await cache.query(cityQuery.setArgs(i, ...cities[i]))).getAll(); - } - - const countries = [ - ['USA', 'United States', 'North America', 'North America', - 9363520.00, 1776, 278357000, 77.1, 8510700.00, 8110900.00, - 'United States', 'Federal Republic', 'George W. Bush', 3813, 'US'], - ['RUS', 'Russian Federation', 'Europe', 'Eastern Europe', - 17075400.00, 1991, 146934000, 67.2, 276608.00, 442989.00, - 'Rossija', 'Federal Republic', 'Vladimir Putin', 3580, 'RU'], - ['CHN', 'China', 'Asia', 'Eastern Asia', - 9572900.00, -1523, 1277558000, 71.4, 982268.00, 917719.00, - 'Zhongquo', 'PeoplesRepublic', 'Jiang Zemin', 1891, 'CN'] - ]; - - const countryQuery = new SqlFieldsQuery(`INSERT INTO Country( - Code, Name, Continent, Region, SurfaceArea, - IndepYear, Population, LifeExpectancy, GNP, GNPOld, - LocalName, GovernmentForm, HeadOfState, Capital, Code2) - VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`); - - for (let country of countries) { - (await cache.query(countryQuery.setArgs(...country))).getAll(); - } - - console.log('Data are inserted'); - } - - async getMostPopulatedCities(countryCache) { - const query = new SqlFieldsQuery( - 'SELECT name, population FROM City ORDER BY population DESC LIMIT 10'); - - const cursor = await countryCache.query(query); - - console.log("10 Most Populated Cities:"); - - let row; - do { - row = await cursor.getValue(); - console.log(" " + row[1] + " people live in " + row[0]); - } while (cursor.hasMore()); - } - - async getTopCitiesInThreeCountries(countryCache) { - const query = new SqlFieldsQuery( - `SELECT country.name, city.name, MAX(city.population) as max_pop FROM country - JOIN city ON city.countrycode = country.code - WHERE country.code IN ('USA','RUS','CHN') - GROUP BY country.name, city.name ORDER BY max_pop DESC LIMIT 3`); - - const cursor = await countryCache.query(query); - - console.log("3 Most Populated Cities in US, RUS and CHN:"); - - for (let row of await cursor.getAll()) { - console.log(" " + row[2] + " people live in " + row[1] + ", " + row[0]); - } - } - - async getCityDetails(cityCache, cityId) { - const query = new SqlFieldsQuery('SELECT * FROM City WHERE id = ?'). - setArgs(cityId); - - const cursor = await cityCache.query(query); - - const fieldNames = cursor.getFieldNames(); - - for (let city of await cursor.getAll()) { - console.log('City Info:'); - for (let column of city) { - console.log(" " + column); - } - } - } - - async deleteDatabaseObjects(cache) { - (await cache.query(new SqlFieldsQuery('DROP TABLE IF EXISTS Country'))).getAll(); - (await cache.query(new SqlFieldsQuery('DROP TABLE IF EXISTS City'))).getAll(); - (await cache.query(new SqlFieldsQuery('DROP TABLE IF EXISTS CountryLanguage'))).getAll(); - console.log('Database objects dropped'); - } - - onStateChanged(state, reason) { - if (state === IgniteClient.STATE.CONNECTED) { - console.log('Client is started'); - } - else if (state === IgniteClient.STATE.DISCONNECTED) { - console.log('Client is stopped'); - if (reason) { - console.log(reason); - } - } - } -} - -const sqlExample = new SqlExample(); -sqlExample.start(); diff --git a/modules/platforms/nodejs/examples/SqlQueryEntriesExample.js b/modules/platforms/nodejs/examples/SqlQueryEntriesExample.js deleted file mode 100644 index ecbcbd56b9b6e..0000000000000 --- a/modules/platforms/nodejs/examples/SqlQueryEntriesExample.js +++ /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. - */ - -const Util = require('util'); -const IgniteClient = require('apache-ignite-client'); -const ObjectType = IgniteClient.ObjectType; -const ComplexObjectType = IgniteClient.ComplexObjectType; -const IgniteClientConfiguration = IgniteClient.IgniteClientConfiguration; -const CacheConfiguration = IgniteClient.CacheConfiguration; -const QueryEntity = IgniteClient.QueryEntity; -const QueryField = IgniteClient.QueryField; -const SqlFieldsQuery = IgniteClient.SqlFieldsQuery; -const SqlQuery = IgniteClient.SqlQuery; - -const ENDPOINT = '127.0.0.1:10800'; - -const PERSON_CACHE_NAME = 'SqlQueryEntriesExample_person'; - -class Person { - constructor(firstName = null, lastName = null, salary = null) { - this.id = Person.generateId(); - this.firstName = firstName; - this.lastName = lastName; - this.salary = salary; - } - - static generateId() { - if (!Person.id) { - Person.id = 0; - } - const id = Person.id; - Person.id++; - return id; - } -} - -// This example demonstrates basic Cache, Key-Value Queries and SQL Query operations: -// - connects to a node -// - creates a cache from CacheConfiguration, if it doesn't exist -// - writes data of primitive and Complex Object types into the cache using Key-Value put operation -// - reads data from the cache using SQL Query -// - destroys the cache -class SqlQueryEntriesExample { - constructor() { - this._cache = null; - } - - async start() { - const igniteClient = new IgniteClient(this.onStateChanged.bind(this)); - try { - await igniteClient.connect(new IgniteClientConfiguration(ENDPOINT)); - - const cacheCfg = new CacheConfiguration(). - setQueryEntities( - new QueryEntity(). - setValueTypeName('Person'). - setFields([ - new QueryField('id', 'java.lang.Integer'), - new QueryField('firstName', 'java.lang.String'), - new QueryField('lastName', 'java.lang.String'), - new QueryField('salary', 'java.lang.Double') - ])); - this._cache = (await igniteClient.getOrCreateCache(PERSON_CACHE_NAME, cacheCfg)). - setKeyType(ObjectType.PRIMITIVE_TYPE.INTEGER). - setValueType(new ComplexObjectType(new Person()). - setFieldType('id', ObjectType.PRIMITIVE_TYPE.INTEGER)); - - await this.generateData(); - - const sqlCursor = await this._cache.query( - new SqlQuery('Person', 'salary > ? and salary <= ?'). - setArgs(900, 1600)); - - console.log('SqlQuery results (salary between 900 and 1600):'); - let person; - do { - person = (await sqlCursor.getValue()).getValue(); - console.log(Util.format(' name: %s %s, salary: %d', - person.firstName, person.lastName, person.salary)); - } while (sqlCursor.hasMore()); - - await igniteClient.destroyCache(PERSON_CACHE_NAME); - } - catch (err) { - console.log('ERROR: ' + err.message); - } - finally { - igniteClient.disconnect(); - } - } - - async generateData() { - const persons = [ - ['John', 'Doe', 1000], - ['Jane', 'Roe', 2000], - ['Mary', 'Major', 1500], - ['Richard', 'Miles', 800] - ]; - - for (let data of persons) { - let person = new Person(...data); - await this._cache.put(person.id, person); - } - - console.log('Data is generated'); - } - - onStateChanged(state, reason) { - if (state === IgniteClient.STATE.CONNECTED) { - console.log('Client is started'); - } - else if (state === IgniteClient.STATE.DISCONNECTED) { - console.log('Client is stopped'); - if (reason) { - console.log(reason); - } - } - } -} - -const sqlQueryEntriesExample = new SqlQueryEntriesExample(); -sqlQueryEntriesExample.start(); diff --git a/modules/platforms/nodejs/examples/certs/ca.crt b/modules/platforms/nodejs/examples/certs/ca.crt deleted file mode 100644 index ba907937110a0..0000000000000 --- a/modules/platforms/nodejs/examples/certs/ca.crt +++ /dev/null @@ -1,32 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIFfzCCA2egAwIBAgIJAIH05meRt7kjMA0GCSqGSIb3DQEBCwUAMFYxCzAJBgNV -BAYTAkZSMQowCAYDVQQIDAEuMQowCAYDVQQHDAEuMSMwIQYDVQQKDBpBQ01FIFNp -Z25pbmcgQXV0aG9yaXR5IEluYzEKMAgGA1UEAwwBLjAeFw0xODA0MTIyMDUxMDFa -Fw0yODA0MDkyMDUxMDFaMFYxCzAJBgNVBAYTAkZSMQowCAYDVQQIDAEuMQowCAYD -VQQHDAEuMSMwIQYDVQQKDBpBQ01FIFNpZ25pbmcgQXV0aG9yaXR5IEluYzEKMAgG -A1UEAwwBLjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMoilf6lWZt8 -F+QkZj2zW8PTEiOzqjLDCmEhnoVOPXAbCucaHuqQfK8xHL2FjlkeRWO1egzXBQ/V -K+p2+ck/1D98qL8gYfR8Zf1WUUkgBYjnch9r+BPqIjSwBD8e3HyTIq+DGQ8tYqh0 -1GtP6tooZYF2VBKu7aY69vOOgM16k+2GLR7ILz5MtHARNshu/YYWU8GgIIKXVK8e -DJU1swVhzCWDxX8S9BNuT13WoajOk6GhTkbKIQs0e32arHVfTV0G5s/FlAjtze4r -kWsK+W/IJky98QLZqdHfoXxlPD4Ir6wuRjIZWfuliLmud5umhRdfT18vtApOiPR/ -nxFdITM914MubR6p0jEvnbF2PCQTKQVsGqpPRrsnqQwsLGUJKOGlS+Njwv6zUvJq -xH5AjJcPNnwhc3dwcWoiYgswCcttUWz/a9h2SI5zggfyC3aVl72WmcsDbNgsAIJr -ML5d5EIr+RvbTzQEaqLOHj1q8rysrRx8+HdtKRjXTJsTqpqCkAm+UWnLdlEnxvNW -Asy0TZ65aGAR8ysyEO8s2xq0m2eTai1BPj91Yt3YnozWjvC0fdC6QL8Ksxka7HYO -MYLXkwtlpi3m/dXVEk9Xd9SAE77+9aPN+MYAEvCG6WA2Drb7nOBVm31ATY20cEln -I2YqiMBn05sjohacEww+7LVqYeez1xRvAgMBAAGjUDBOMB0GA1UdDgQWBBSy3uNf -iwlv/7mjyiglCjKMq5kJDDAfBgNVHSMEGDAWgBSy3uNfiwlv/7mjyiglCjKMq5kJ -DDAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBCwUAA4ICAQACrOj3S0CpJVuCsgsZ -JKCnPn0HVfJ0nU8tKMb43xq6r7V7GsUvdJIvzgiBC19ld+mWNUp25B9M9zOf1glL -L9h2Tlu8gg+0DJ/1/ipZLNc36Q77Te8KECDKt8k9eI5N6HLS57mCZgE6CmGhc7zg -notGQxzjfW8XQWDUwqwhfMZ9CjL+Tz7rHbvTCNrg9T0Ha57ajNxONlHsVUSMnbB6 -mN2n2pbpf40X4LL5j+mxxr0v6hfAF89U6hekeRf/8LMDApIc/6iVxGskwCOHZhkc -w761WDHC4gh64cAWUni7YDJSCP8Djgdi34WQs4bk05f3u/86V702doR9JPJsRoQg -P1juHur8vedjSQTqvA5TAt3ct6wkgVmeeqnIDTH2JFNCnssVWtJburOibUHgKvqe -ZH0y3JF2eCcVXPPq6M6qM7W2IziArsZs22tkos2ARaDDU8ekmsEOH9SNphVICAet -AT6b8YyOutTXO4LIN1TUeXmeKMpOAA2+YNCp+/OxbzkqvZxYuvbBtoSiIfrHyW4k -rE0rRTYpB1Mk7R4+hwPnJim1OvZ+vLeLzvgGIyZKKiku2bp0YB8KGsAchnnJVlyo -Oca/YSkKIBYCiQjxg5rX1/ZonhAkRbuqzmQdb9bJoGoN8kUdN9wvZHC3YPtox1Nd -GoJSdO3MNkK5EwafrMAGh2Jmxg== ------END CERTIFICATE----- diff --git a/modules/platforms/nodejs/examples/certs/client.crt b/modules/platforms/nodejs/examples/certs/client.crt deleted file mode 100644 index f88e11c34880e..0000000000000 --- a/modules/platforms/nodejs/examples/certs/client.crt +++ /dev/null @@ -1,30 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIFJTCCAw0CAQEwDQYJKoZIhvcNAQELBQAwVjELMAkGA1UEBhMCRlIxCjAIBgNV -BAgMAS4xCjAIBgNVBAcMAS4xIzAhBgNVBAoMGkFDTUUgU2lnbmluZyBBdXRob3Jp -dHkgSW5jMQowCAYDVQQDDAEuMB4XDTE4MDQxMjIwNTEwNFoXDTI4MDQwOTIwNTEw -NFowWzELMAkGA1UEBhMCRlIxCjAIBgNVBAgMAS4xCjAIBgNVBAcMAS4xIzAhBgNV -BAoMGkFDTUUgU2lnbmluZyBBdXRob3JpdHkgSW5jMQ8wDQYDVQQDDAZDTElFTlQw -ggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCp1yTtzT01KDx6qyidy4GQ -C/NbPcOkPHYYfTPkPy4xvdfPfx0FHBHxY5iqg7V2q5dbpVH1NOablC/sWOjwMXlQ -Hs0M48Q0SRXgJA2a4wqKMfpJ6q8fxVbFENmm8d7YA3dXq6KxXq5yDxCy7pZk/ILP -CbOobSHxA8NI0Dla9zMA12b6pdu2d0aK6fD98FdUU56Dn8re8YOlEEtRZmUZjIkt -yoIP+RymKttz9opbSeY4gy/na9JziS2Ij6SVwnpdFIVvMXtux61WlIe9jy/JRWXL -dmY8qz7ooTUofgV8wd+E9iTIYwJa26C8+AV1XGuI7aQHPSQwyRm0PGJaC4Bdutkf -eeTu5KVxIQFgAUV2a7EYR9xiSiMW2DjCjTEShZkxs13jTG4tnr6KxUYCoNIy42XH -WVmb7TKVkhpBKM+icqFRQ/0OhqZcYl1VKlYSutu7z32jGta+AgedMagV4sSzhHJf -U8lBReZkFVo0Bh5wgZbmgwykW1YzqoMVxOZtaoF/4NyPfIo7icmI9SfM7Jbo/0zs -CdWgetIPM8iEwXr4W1TjDRM6VLDnEMo77HUNHqJi9YQhIy0exsBdlfJnVpPGS3fj -jA90qoUDoEFScDmAYsD8pyrSFkE13KBClUjQKn6KdNQfRxQApf972X7tqkMbX5KQ -Np0GKuaTHt2xxirgJroeiQIDAQABMA0GCSqGSIb3DQEBCwUAA4ICAQAT5wABZANT -GUScEJo9NK2+nEVVCrf3YcirwB4uw2log/DamQnHeC2W7/YOQ+RAmqp0m4VX39pA -jxUlQb546rBKL8mfzc88ReN/g/EoDEri1PKToGF+rntwtgpoj+ID2sK4kDyJRemJ -d6lrNTIvB1zu6Ra6P5Y5Iq5swSZtigFkevwHfHACEs6EemWz8xsipBjOK+oX3sen -N8t/KGiw0rsFXoXv/bKFaB3s9VcX8lbMG7FgPqlFCQnkEPqGSmoT8hNSqK1ZM3VK -ueRkZVHaynZqoGIU1hglDWtObTUiz7Kgwv3MTbduoZE7hBzBSokn7aGjypdrTFuZ -jrSKNe+sJePw7IfvuSo5Nnk5VNh26FS0C9EeeqCCAT1B/+u9M0DkmK6EPDUIly9f -XjTlR04UaWf0EHgTroDY/KuDBR2ZKx344fr/52xZMDUoqNT2t/HW7cX2ff8vbsME -IykmzSfVjE50gRAZMqAhDlWKR56VyuAwjpBBGAo7Zw3eyAQjVLYU0/f7/HONYchx -wWPXCn1isRDFtzxx8WhuhtXUnSHgwnro+79W75mv9c6bkHoAH3pVbA9Wx4+hQv18 -V8SHa9CJn8absmNTSBGMXo+lFDDRnsjRDBCPElfkS5+ilvcJtfuqdtRvkR1ERil0 -N6gW1Y8iaVI7pfPeyWoM9GLTuvLmAYcuKQ== ------END CERTIFICATE----- diff --git a/modules/platforms/nodejs/examples/certs/client.key b/modules/platforms/nodejs/examples/certs/client.key deleted file mode 100644 index b08c63c4a93b4..0000000000000 --- a/modules/platforms/nodejs/examples/certs/client.key +++ /dev/null @@ -1,51 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIIJKQIBAAKCAgEAqdck7c09NSg8eqsoncuBkAvzWz3DpDx2GH0z5D8uMb3Xz38d -BRwR8WOYqoO1dquXW6VR9TTmm5Qv7Fjo8DF5UB7NDOPENEkV4CQNmuMKijH6Seqv -H8VWxRDZpvHe2AN3V6uisV6ucg8Qsu6WZPyCzwmzqG0h8QPDSNA5WvczANdm+qXb -tndGiunw/fBXVFOeg5/K3vGDpRBLUWZlGYyJLcqCD/kcpirbc/aKW0nmOIMv52vS -c4ktiI+klcJ6XRSFbzF7bsetVpSHvY8vyUVly3ZmPKs+6KE1KH4FfMHfhPYkyGMC -WtugvPgFdVxriO2kBz0kMMkZtDxiWguAXbrZH3nk7uSlcSEBYAFFdmuxGEfcYkoj -Ftg4wo0xEoWZMbNd40xuLZ6+isVGAqDSMuNlx1lZm+0ylZIaQSjPonKhUUP9Doam -XGJdVSpWErrbu899oxrWvgIHnTGoFeLEs4RyX1PJQUXmZBVaNAYecIGW5oMMpFtW -M6qDFcTmbWqBf+Dcj3yKO4nJiPUnzOyW6P9M7AnVoHrSDzPIhMF6+FtU4w0TOlSw -5xDKO+x1DR6iYvWEISMtHsbAXZXyZ1aTxkt344wPdKqFA6BBUnA5gGLA/Kcq0hZB -NdygQpVI0Cp+inTUH0cUAKX/e9l+7apDG1+SkDadBirmkx7dscYq4Ca6HokCAwEA -AQKCAgAul8oWvtZKzfYBhREIcPrjRJQHdONGHBwdzcM9m6OVm8onr2yLqU621Sbd -qHJQ0vQb/TeFuHSHO9kF0sJcmoX4V+rS3W1HFsG8ksd0tVJ/5QQP4SUX5zBNsbi0 -FuiWhCTqVTi1xg6/Vai0HcX+gFN2buftjbrg/rJFOHJzpRtF4NHsczHaVdBxbYpi -b9vVU3dKDr09+i2uS9ENzLRxlN9RQ5v4u9ODNoCryHfeYWCaIkszBp5eecSXESkK -uKaPAIE2pvGAy6Ce/vJaK3zlj3dEoP+dJzGD6i3GJQRmXF1wgYJHwvmzaUsobDY7 -IxaRIvh7z+csxw6ZJnOo1jzp+cd0a7iMSjz6BHjQuStnrTeUfFF9ZYyq3vV9vbKY -5hvoeKuIj7LY/g5KV223vx5aojxiJFTgJ8DyJVYAC8LiMhF61Koua/S6WTpPR6Ga -V56sF9JVqefVFGwOl4npK0TUUFqrHo8/grkxbO5KddgUU4CW4R/PK1jHDXo9d1pj -fTD04kfBS6gAjEYdc+Va7YO1T72Ejjw0p0H5e/0xP/4j8xE6r/Kaq0nw3RppIY8d -EuZDMRG/fvY/8/BakJr5xHZLIt7nLppP9rH4qZKVBylTy5P0kLcenDu6yYYBqUkt -SAwOK4al/NYfAO4kgNa16uEmNexRmS6IVKUfZn0PJbbcTB/NnQKCAQEA0XR9GqiH -VhI4td9qitxLSsM4lukLl1f2seJKsGGkyiJ7SgMXbpe5wmamPKT/8cYlcMD0gPjL -jKZP5CQqTVuI2Zwsy6/KH3/UlCjVp7qOHeVcHLJs95JS+hiBqGK56shNpdRWoG/g -7z3lnZuEFY5gfEWOjXGQOJIHp3b64njDAln31zjXNpHEpv0RPsmkUi1jNxpi1XDp -J7M1ocoB22jn6voXxP6jvg48tQqz5FPN5fGr+WqkBPwcgtf2pN+weGAc4APrTxM2 -CsWk/aI2eGte1Ednk0Ci+RthgICS+cxj6cWgSQBnesbEH9+MOsn3Tp6rPGZ6FHsZ -PSqnVMszXrvEtwKCAQEAz5UNaITyiw+ocOM8hgMnAg3C+whCTlts6NDJcjBLax5e -uPCqYyMJmbB78mgmu5ZCB0CUcppxm73hGKiX+/wOPaAobJcqs+mG4YtmfgjZMYZQ -s0C1gaZFc+mAXMFaR4Gqr9EXNtwh+zaHVUupAdATS0VZ2XSv4t2bDoeDZWnGPCZb -9wfGMuorR8po8Fv8kH3G771DqZXSXbgVgsYUdIrchGYhPRaSyhvdGcRFootwEEjv -PJ2S3E2uJQlZKlWAnQ5SGxKMWOWPSAGSK284pR9+HlvQpFD3SH1Ue5bAQWhRsVyW -uMKnH0XpMOmYzUcXEKy1A41IbA9ZpoQoUbTZ+bp2vwKCAQEAvd3qyg+bHtrFrZgo -7FdlqQ/ubF40s6x5ZCbNrbXVu6YmPKEwzH+dVCvY5YBswq3roppHCeJ+IbFhGl3u -OtGO7DQ2Jy3i+0rVWLjrdHAYA+G17g2P2Zw6u5sbbZiRD9MjD/+7xxOjwztIueYP -hbram8wxvOYE5kL5zUR9iG4P2EHV+LL94+mfagBdcZ0354ZdOcYhcXo44FQDefW0 -WUBvewHaKijqJY6iWTqqd3/AVYENc7rHk/01myZJ3osnXPdDNY5X8AZqJrmjJoe0 -+NPb0nIn4cPl+ApqCCKFGQu+RltvQL2tEA6+GmZ6p5ANLqeGceozH/22k0vnA2Zv -2qA7YQKCAQBnPde8WxsShMge1TXd5SV6hQOrvNDVje0d4fG/BDwOW716t9/WjK+S -q88JojlZZQMT/k+WrC/C6O5SSE/G+PbQOZ7BW3HWp1f5R07Dcn0rf4UVkiJ0CBFU -9BZui4/uLpSI+zJTi6qu+dDXYFj/WNCvyB9G4x0zdUpQMJ/uSWxZsC5fL5Oo8QRz -oT0OBoIYDyZpSDWl26kUCaFROFkmGYZRp0Xyzw5UzQTrcs27aSRkRRIPkMNhJJVv -QDYDsyDTfDLj2hbJg+r+QiHDzn5ayc39JWcgwlAq0oK5MSIPpeWzk7w2ykE6cZfo -RtZDio7zMSKaUKNrczsAcYxoDs22wcGbAoIBAQCKlVIcL3e7exSFVRNORbnLosWh -cYQquUZlxq6TkS14lJsGQ+pT02gAEpJktYEfiiBMG/mHXeaGQmMbAYgF7J79VcvN -CJ1qZvvtSCSnWdMGlhs5zHzjCqk9sywtxRB8XJpp19cM7oTl4PU+ditoGTRlo0Ea -cMuqdfg/SH/VExUyJzjyFKI5qKUnaTa83PZz4h0kt48oa4tlXzwBVKZYy/77qfQk -ajH+THYPZ+32iDEVCpiJ9Cg8yTWGT7VxtgFRvEOBPY28T6zenl9Djl8omCOAz07a -Ozq7QkTy4L0eCZrQ1BPHcmulHUuL+tZqKRukyBrtkTPanZEOHZ5RTfF32BVL ------END RSA PRIVATE KEY----- diff --git a/modules/platforms/nodejs/examples/certs/keystore.jks b/modules/platforms/nodejs/examples/certs/keystore.jks deleted file mode 100644 index 1da610f90039faad2279c641b68d2c0a9fd1997e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3828 zcmb_eWl$81*4|)&C6z`}x>-^{q(M4FmUyMR!G)z%TtG@<2}KrI8l)tJ7f?Xy?gr_u zrKI8d-udp#H~07b@ytBWnK^ULnK@^kbGvuD2LJ#-e*pY9fFggGO=F&{8~^|fhlM~x zU}X42{P;jTARp*H5C{R_g+M*>6679SvA&HJg%NPDsOvAlggX&d0*z{amnGb7&Q|aV zKqal>hBUooJ2h?gKSle(zG%)bW^{B_xuidJ{(ySusUz|vh5`ej*qHQrl)Ok=uA}{N zi?=*IBon>P4s-4kbf8afAIp)~yx-Sx=gVHD?q(Hv;d{vuG`WDmuiKWg0L44KHV~h? zsP;0#8rcTjPLlK&Guh%~#%C z)TUMvnioZ0*nW)|7+2WvUhZxx4|xL zsc~)QBb<4o5I&@yH)Bq>?O^nx7R1*rLF0n*ctGKm?}YFESwParERiussLEIF>`XJ` zpcQ`4OjzmxzqQ<}^W>8^nlr=vGF3?HjZXWgQMz=49*>V!@yaFQo|v?p@rAVPo3FRh zwMta){tqu2Q@!sT4Fz`q> z)2R;jQCNYempWE`#LVVGZ=c6Xc_i44gWN9>^f|$pQ!;RxUBYuQ#@%Uc9805Z2{z>_ z8$+)wCpQnDM~|GnhdC`yob}Vfh)?4hd=@&Y2zRX;hqC8~-t+X9c_&PSYluItPiDS9 zI)4Qz98D!zROb|_`Xo19Hw6FnEWSRPJ0td2X?Mkh*n0^qIIrkzC>Bl->3XQ8>9c5l z!IZM2S22orw6`4DirBfmfr=Fw^VZ)jw58 zw(7wt9@p!W)z@My_L-sd@JMvP`j8ao?tTpDWya+9FVRf8V=u(Z2Lh8};1rf<5{g#>trPJoPKCQW&KIvfpiN3r=#bZc&4F&-@9z49QP3O| zFRC;IG-}!@w7-ksU)ESU%s43?EzCQS^NfC%Mr7Jg1SyR@t_eGB+hBPiwv*o()nSoH zar+mt6(Vo{sJdq}$YCv+;BCH9$@Ewj{O^MhI|tKMH?bNBa4qJ*_e7`O(m>K1v_0ij z6=zW*5w9EwAq%xCu1&vILJ5-l$|(Z3Z7w#b?`LB7K7J71pq>;|KF5nF-dFu5@6S|= ztfBhLi=;0}%`&2RyBm-3cg1x|6`ZC&+n=1BKyl%n@NUGZE|;)(A&Z9PiT+Kwr;mYE zD;d24kKf$K1`bAgoqTiTjuu@3_N}hlnNjl#s_iYbGt|V1uwQJdspyxv|4Wh1G0_Fk z8<*f-TG>0LWV{OzRc&eHt84K`(#iGaZm-U37PrJ)$5WUx&hncvxr57^W#tzucN~PS z?b`i=IhMJex7Z^8+P4P8N@Jgp9$C51;#mrr8l5biWVO4M9Mfz|br_zJREw+R=38*p zNj@$)96%1V=`yMn^gN{{UG(urrnE6G^BfHyJEq?oThI_0uJ?|&#>kw<+Qs<4$!q6~ z%a%B%q0T>;&;8i=n;_%_7x|UCi+PK9B2rS{&tmYU&?*XO7EkAJlXo2R#MZoI$A<2_ z5@W)gUf&`DaDBDWYB2$}9Dkh!7YvQ=S-m`QEdFVFElr&Lqs*D-o}G=`Cz?I#Ax8mQ zA@7udUKNxI?T{4WRi_%&50wP2;7Hu&*eG_5!F#GG#+p8)%SE&pV^)=}!?p~VH?Bx$ zBfbfnPcnFlt#-73@iVuFQ{vq z()>U+O6mQ@Qpjs5fg4Xn7G_61yJk;A~ENT`yi-ae+w*l?GhxMoAqDRk*L+NcQ} z5LH{*i&&2iGKAOY^s973ZOFrZ8I&GSt(FIp&Y_+xBZ`Vu?kdWN}p^ ze?0j;>fR1_%((WBR^5CX6M_61R7oPcDs#&iOmazV8^rysYM}=zgliIB-;1)NwIl3O z)6l*xwx#sG?lzEL`^B3?2jKTkRH#z>&{MzJX9y{>L4c1{BU+0D%mp|4$!57k2m?jy zwNBOic{xcR$uQi@ZxhGKy!7H#reXLIJ|}OOI##`Es%WS_uM=z2d}*5`29&3Cx6Ku4 zMoY)FC$@4twnFQ3jvZeulwM73&5-n^F@e@FatCe$E&8LE7inA1_D1LG*kv~s>P;A_ zZ8$4GOl;WwvEvc%si*Rl!rRa@4fC6i$QT8^m!CA|?JZ4{;`jw+?`}Hqk(NiSI>7+S zm~8_~hKYG&Ph*`Y-?@b38i@8QW#^f=cReghZ|D0)FkpBk zE{{7&72+9WVy56h6NaD_VgAdNE_`~M1xj&|Ryy(_d~M2Pp$Bcg7Gt7C(JE#a)>Pf2 z9Fdw}cxz*jiTvq!q(9|zVkvdkLqxu+iAq`V9xPR5GdFUmyXhWXJ`L(gSB6WhW5E7V zy(wT<{m)2p+G0lK;jE880k@8W(xRnQCo)YkoJaJlEF5jqHz(Y3x|w((YetffN)Bt^ zky3B+{w1un)9c}gL3P-%`NZAYc)_hrwR8o&)_C_A2HCd!$KT}4+y35XMhUX4lh;I8 zXz@bLJ-frr!EC5q%9hTtd|v#l?kQEW#FfH}kqhKoMZ%1xY$ne6gHjSiR^17C*=0w0 zqPCf6lWdY56#awcOwRTk3;!yvk|xS#E(XhRiyOS$tYE&r?W*irmt6glxy-NX4j-W5 zqP^tcS7p=Syd$c?b!ZjW)281W2|IPFBs<&?-BmVbzJcDvlVbnemlR(`(ZLQs$JP|&y5D?q{AN9`{3Jw901OCK` zKp`L?;Co%yh-l-g-y>Oq){;xskom>_q+tf8FI0mFM%g?A2i^Mcsckx*{41gkF5Y6{ zxT_$`-wyE#s`6!JA$(O*zDyWqO%sLON+%qRI@?^K}^3q$sjyBI_ zh-HIMoMN-@JcKSh6>1{RzO}_<&)EKQ07y&r2HhArG9C%az^|u}OOLvxdq0aEv5k;N zecln&qbf?t@!c^IvcpepNqbz^Iy&(fwbJsi|N4zHUvov%X;8fO5b`C}yRS>of}EEu zbu_W_b#xsq?@|GjEEGYE^*saI+@Hi$`M}TFSJ6?9CcmW;ezj|t2Ex4I?bD8j!TxTq zhch-VifrWT8+c0)FoGm*Imb(JiT1K*(KNmL*7b*Voc5k*bV*@Y`O_W43Kf##gPusQ-fW{7URlGWy(In|7+gmsiR~?HC8k*&4x0|DY>mr)CWp{Or-};y&qW3IYQG z|9uR9HUtRxu%<1^YdK^ehjicSiC4?}OkHRilohUhOaUSD&zYrC6syn|;eRCoc#glR zj?3P0^xy0+x79l1xI_6eF$h=s3=}V1<*VeNx;(L_kI2>`io8_X@KhhNh;pp9)YrUR zzXsaS=I=*V_mAP1>~JEiyh)-pt(wAjY~82tZ>R#e^-`}5q6OH#^V4B#iqyloi@rYG zD-)FOXA}n0Je*?|yd79_)K)YZ{f5KFk!av2Ha2hmeWh-ll@DL)L4$Ku3j6T@nuNos zT*qZHQ+0VV#EoIMrV>&8m#LpuHMy|6T~DdjCUME2z!6Qv#yv}`6=5_c+o@WOlyyUz z#jU|n>O)=M4+t}#pX8#EE!?H4%atN=@nc%>>5Nmv;U|jY5`|il`QNY@Kl2y;Z2OU) zQs3{S|3rioRK{PeQL*|_<02LN73ffOKwZ{x7x43PJI{I>TH*(l&&iV$<>b;$rQIrC z?9R>uh5fhDF{8t;y|?m7N=Lq7=((g`GnZ)23V5tgwZ}JECA)ul3?%KGtBoB{b0Tz0 zS|(wbi?qqUoNUM8RV+^n$f^vicJ@!MW##LHiZzqi{Pz3Zr>I$PQWX6JNZ4PZV{Z;b z>$MjYlD0s0reDUmseh>p?3eW)@3p%vC_04TxSI8H2fLjqXO%}uwWB*jRNb2~mPaoN XGN}`N1L&$(00@-~9Llb&H0$%(qji9nI0-HS6k7+53pObsj<7+9MPnpo=%nwZlU zFf%bSF>x|9etDKYar;hX170>xtu~Lg@4SqR+^h@+VTRlWoNUaYENsF|Zb61z1{@#` z2M?njjLi;WD;p?+#JPB+9G!h#6@oL<^D^_&6&y=TGV+TuODYvS^O9j2n1LD$Zl;k>Qlm)PGAO zXV-{7QAxAi9DVq*kn-kLMu)i)73a13*%nB1J(rSuHKAs`q0HXazDPOOZ{vrHI$z%hIz1*Fe$x7>+CHZxeR+L=H z_J4ItBek(CL}=aHWmexl_cffYn*6p+SMG$qozIp6L9-Kif7`@@4=zw>njW%Vj%TXr zX4b?rs?A61g}w;q`Nv*cxZ>R8g$w=MPAPJmRM*a0QyT9Z%l7R2(J35n&%V>1n9cPw z|Ad;)-j7T-S6;louqM^Uj${2AJvSrC$lpslcCIU*y{uI{-alS{3zuKVm-_jFv5LmF z*PHcn>FhseZ@`epSa7WPTxCi=4s}f8#)Y4*#`S!pEzm%l)mk6 z!jiS)vTroocjVZPnQL%ANw4}bY_e1yqy^df}gdG z1m5f1mfA8qeR7trqn&+e(%l>Ldam_-*iw68m&1Op&5}}Y%J>YMu21GpU8ei&@71e9 z{^8|U8ie=#`?~n-k7Eo%AKG3fnDK4{B?zZ9S71c&sJU}Hb;fc=KtTh_>_h!mr>8^nVdWZ z@*rtt76}8f2J8xWKnjFeSPhsN8UG`vIbgN|ra49irZq3VdpoRDjc(e+Evd3#xm_)L z=%}vd|F;U?YgX1$tMVzwtwq5;;+@>9KYO1id$PRR z!xzkS_s;e;Dvgozs#c!hHT@@GRXw;?XU7Hu>IzG_)H7}*s=+4Bl3U$$#&#zvb zTV=d;o3cg2x??%Fvr`tGZE#(1IQaOISqJ&#uk^D)$Q5deeMUFvYMBcrryn6B?({?! z%o9*?-M#8uifsP1lMAwVKe@`9-_cJg*q-n^<9KkaR8vsN+cRcPJB8WiuQ|Zho|JZs Z?U`hM`nC+cfZOMEm$hwVve?=z4gf+XQNsWL diff --git a/modules/platforms/nodejs/index.js b/modules/platforms/nodejs/index.js deleted file mode 100644 index cce86ab5c68fa..0000000000000 --- a/modules/platforms/nodejs/index.js +++ /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. - */ - -'use strict'; - -module.exports = require('./lib/IgniteClient'); -module.exports.ObjectType = require('./lib/ObjectType').ObjectType; -module.exports.MapObjectType = require('./lib/ObjectType').MapObjectType; -module.exports.CollectionObjectType = require('./lib/ObjectType').CollectionObjectType; -module.exports.ComplexObjectType = require('./lib/ObjectType').ComplexObjectType; -module.exports.ObjectArrayType = require('./lib/ObjectType').ObjectArrayType; -module.exports.BinaryObject = require('./lib/BinaryObject'); -module.exports.Timestamp = require('./lib/Timestamp'); -module.exports.EnumItem = require('./lib/EnumItem'); -module.exports.Decimal = require('decimal.js'); -module.exports.Errors = require('./lib/Errors'); -module.exports.IgniteClientConfiguration = require('./lib/IgniteClientConfiguration'); -module.exports.CacheClient = require('./lib/CacheClient'); -module.exports.CacheEntry = require('./lib/CacheClient').CacheEntry; -module.exports.CacheConfiguration = require('./lib/CacheConfiguration'); -module.exports.QueryEntity = require('./lib/CacheConfiguration').QueryEntity; -module.exports.QueryField = require('./lib/CacheConfiguration').QueryField; -module.exports.QueryIndex = require('./lib/CacheConfiguration').QueryIndex; -module.exports.CacheKeyConfiguration = require('./lib/CacheConfiguration').CacheKeyConfiguration; -module.exports.SqlQuery = require('./lib/Query').SqlQuery; -module.exports.SqlFieldsQuery = require('./lib/Query').SqlFieldsQuery; -module.exports.ScanQuery = require('./lib/Query').ScanQuery; -module.exports.Cursor = require('./lib/Cursor').Cursor; -module.exports.SqlFieldsCursor = require('./lib/Cursor').SqlFieldsCursor; diff --git a/modules/platforms/nodejs/lib/BinaryObject.js b/modules/platforms/nodejs/lib/BinaryObject.js deleted file mode 100644 index 478dbaf320fc2..0000000000000 --- a/modules/platforms/nodejs/lib/BinaryObject.js +++ /dev/null @@ -1,530 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -'use strict'; - -const Util = require('util'); -const ObjectType = require('./ObjectType').ObjectType; -const ComplexObjectType = require('./ObjectType').ComplexObjectType; -const Errors = require('./Errors'); -const BinaryUtils = require('./internal/BinaryUtils'); -const BinaryType = require('./internal/BinaryType'); -const BinaryField = require('./internal/BinaryType').BinaryField; -const BinaryTypeBuilder = require('./internal/BinaryType').BinaryTypeBuilder; -const ArgumentChecker = require('./internal/ArgumentChecker'); -const Logger = require('./internal/Logger'); - -const HEADER_LENGTH = 24; -const VERSION = 1; - -// user type -const FLAG_USER_TYPE = 0x0001; -// schema exists -const FLAG_HAS_SCHEMA = 0x0002; -// object contains raw data -const FLAG_HAS_RAW_DATA = 0x0004; -// offsets take 1 byte -const FLAG_OFFSET_ONE_BYTE = 0x0008; -// offsets take 2 bytes -const FLAG_OFFSET_TWO_BYTES = 0x0010; -// compact footer, no field IDs -const FLAG_COMPACT_FOOTER = 0x0020; - -/** - * Class representing a complex Ignite object in the binary form. - * - * It corresponds to COMPOSITE_TYPE.COMPLEX_OBJECT {@link ObjectType.COMPOSITE_TYPE}, - * has mandatory type Id, which corresponds to a name of the complex type, - * and includes optional fields. - * - * An instance of the BinaryObject can be obtained/created by the following ways: - * - returned by the client when a complex object is received from Ignite cache - * and is not deserialized to another JavaScript object. - * - created using the public constructor. Fields may be added to such an instance using setField() method. - * - created from a JavaScript object using static fromObject() method. - */ -class BinaryObject { - - /** - * Creates an instance of the BinaryObject without any fields. - * - * Fields may be added later using setField() method. - * - * @param {string} typeName - name of the complex type to generate the type Id. - * - * @return {BinaryObject} - new BinaryObject instance. - * - * @throws {IgniteClientError} if error. - */ - constructor(typeName) { - ArgumentChecker.notEmpty(typeName, 'typeName'); - this._buffer = null; - this._fields = new Map(); - this._typeBuilder = BinaryTypeBuilder.fromTypeName(typeName); - this._modified = false; - this._schemaOffset = null; - this._hasSchema = false; - this._compactFooter = false; - this._hasRawData = false; - } - - /** - * Creates an instance of the BinaryObject from the specified instance of JavaScript Object. - * - * All fields of the JavaScript Object instance with their values are added to the BinaryObject. - * Fields may be added or removed later using setField() and removeField() methods. - * - * If complexObjectType parameter is specified, then the type Id is taken from it. - * Otherwise, the type Id is generated from the name of the JavaScript Object. - * - * @async - * - * @param {object} jsObject - instance of JavaScript Object - * which adds and initializes the fields of the BinaryObject instance. - * @param {ComplexObjectType} [complexObjectType] - instance of complex type definition - * which specifies non-standard mapping of the fields of the BinaryObject instance - * to/from the Ignite types. - * - * @return {BinaryObject} - new BinaryObject instance. - * - * @throws {IgniteClientError} if error. - */ - static async fromObject(jsObject, complexObjectType = null) { - ArgumentChecker.notEmpty(jsObject, 'jsObject'); - ArgumentChecker.hasType(complexObjectType, 'complexObjectType', false, ComplexObjectType); - const typeBuilder = BinaryTypeBuilder.fromObject(jsObject, complexObjectType); - const result = new BinaryObject(typeBuilder.getTypeName()); - result._typeBuilder = typeBuilder; - let fieldName; - for (let field of result._typeBuilder.getFields()) { - fieldName = field.name; - if (jsObject && jsObject[fieldName] !== undefined) { - result.setField( - fieldName, - jsObject[fieldName], - complexObjectType ? complexObjectType._getFieldType(fieldName) : null); - } - else { - throw Errors.IgniteClientError.serializationError( - true, Util.format('field "%s" is undefined', fieldName)); - } - } - return result; - } - - /** - * Sets the new value of the specified field. - * Adds the specified field, if it did not exist before. - * - * Optionally, specifies a type of the field. - * If the type is not specified then during operations the Ignite client - * will try to make automatic mapping between JavaScript types and Ignite object types - - * according to the mapping table defined in the description of the {@link ObjectType} class. - * - * @param {string} fieldName - name of the field. - * @param {*} fieldValue - new value of the field. - * @param {ObjectType.PRIMITIVE_TYPE | CompositeType} [fieldType] - type of the field: - * - either a type code of primitive (simple) type - * - or an instance of class representing non-primitive (composite) type - * - or null (or not specified) that means the type is not specified. - * - * @return {BinaryObject} - the same instance of BinaryObject - * - * @throws {IgniteClientError} if error. - */ - setField(fieldName, fieldValue, fieldType = null) { - ArgumentChecker.notEmpty(fieldName, 'fieldName'); - this._modified = true; - const field = new BinaryObjectField(fieldName, fieldValue, fieldType); - this._fields.set(field.id, field); - this._typeBuilder.setField(fieldName, field.typeCode); - return this; - } - - /** - * Removes the specified field. - * Does nothing if the field does not exist. - * - * @param {string} fieldName - name of the field. - * - * @return {BinaryObject} - the same instance of BinaryObject - * - * @throws {IgniteClientError} if error. - */ - removeField(fieldName) { - ArgumentChecker.notEmpty(fieldName, 'fieldName'); - this._modified = true; - this._fields.delete(BinaryField._calculateId(fieldName)); - this._typeBuilder.removeField(fieldName); - return this; - } - - /** - * Checks if the specified field exists in this BinaryObject instance. - * - * @param {string} fieldName - name of the field. - * - * @return {boolean} - true if exists, false otherwise. - * - * @throws {IgniteClientError} if error. - */ - hasField(fieldName) { - ArgumentChecker.notEmpty(fieldName, 'fieldName'); - return this._fields.has(BinaryField._calculateId(fieldName)); - } - - /** - * Returns a value of the specified field. - * - * Optionally, specifies a type of the field. - * If the type is not specified then the Ignite client - * will try to make automatic mapping between JavaScript types and Ignite object types - - * according to the mapping table defined in the description of the {@link ObjectType} class. - * - * @async - * - * @param {string} fieldName - name of the field. - * @param {ObjectType.PRIMITIVE_TYPE | CompositeType} [fieldType] - type of the field: - * - either a type code of primitive (simple) type - * - or an instance of class representing non-primitive (composite) type - * - or null (or not specified) that means the type is not specified. - * - * @return {*} - value of the field or JavaScript undefined if the field does not exist. - * - * @throws {IgniteClientError} if error. - */ - async getField(fieldName, fieldType = null) { - ArgumentChecker.notEmpty(fieldName, 'fieldName'); - const field = this._fields.get(BinaryField._calculateId(fieldName)); - return field ? await field.getValue(fieldType) : undefined; - } - - /** - * Deserializes this BinaryObject instance into an instance of the specified complex object type. - * - * @async - * - * @param {ComplexObjectType} complexObjectType - instance of class representing complex object type. - * - * @return {object} - instance of the JavaScript object - * which corresponds to the specified complex object type. - * - * @throws {IgniteClientError} if error. - */ - async toObject(complexObjectType) { - ArgumentChecker.notNull(complexObjectType, 'complexObjectType'); - ArgumentChecker.hasType(complexObjectType, 'complexObjectType', false, ComplexObjectType); - const result = new (complexObjectType._objectConstructor); - let binaryField; - let fieldName; - for (let field of this._fields.values()) { - binaryField = this._typeBuilder.getField(field.id); - if (!binaryField) { - throw Errors.IgniteClientError.serializationError( - false, Util.format('field with id "%s" can not be deserialized', field.id)); - } - fieldName = binaryField.name; - result[fieldName] = await field.getValue(complexObjectType._getFieldType(fieldName)); - } - return result; - } - - /** - * Returns type name of this BinaryObject instance. - * - * @return {string} - type name. - */ - getTypeName() { - return this._typeBuilder.getTypeName(); - } - - /** - * Returns names of all fields of this BinaryObject instance. - * - * @return {Array} - names of all fields. - * - * @throws {IgniteClientError} if error. - */ - getFieldNames() { - return this._typeBuilder._schema.fieldIds.map(fieldId => { - const field = this._typeBuilder.getField(fieldId); - if (field) { - return field.name; - } - else { - throw Errors.IgniteClientError.internalError( - Util.format('Field "%s" is absent in binary type fields', fieldId)); - } - }); - } - - /** Private methods */ - - /** - * @ignore - */ - static _isFlagSet(flags, flag) { - return (flags & flag) === flag; - } - - /** - * @ignore - */ - static async _fromBuffer(communicator, buffer) { - const result = new BinaryObject(new ComplexObjectType({})._typeName); - result._buffer = buffer; - result._startPos = buffer.position; - await result._read(communicator); - return result; - } - - /** - * @ignore - */ - async _write(communicator, buffer) { - if (this._buffer && !this._modified) { - buffer.writeBuffer(this._buffer.buffer, this._startPos, this._startPos + this._length); - } - else { - await this._typeBuilder.finalize(communicator); - this._startPos = buffer.position; - buffer.position = this._startPos + HEADER_LENGTH; - this._hasSchema = (this._fields.size > 0); - if (this._hasSchema) { - let field; - // write fields - for (field of this._fields.values()) { - await field._writeValue(communicator, buffer, this._typeBuilder.getField(field.id).typeCode); - } - this._schemaOffset = buffer.position - this._startPos; - this._offsetType = field.getOffsetType(this._startPos); - // write schema - for (let field of this._fields.values()) { - field._writeOffset(buffer, this._startPos, this._offsetType); - } - } - else { - this._schemaOffset = 0; - } - this._length = buffer.position - this._startPos; - this._buffer = buffer; - // write header - this._writeHeader(); - this._buffer.position = this._startPos + this._length; - this._modified = false; - } - - if (Logger.debug) { - Logger.logDebug('BinaryObject._write [' + [...this._buffer.getSlice(this._startPos, this._startPos + this._length)] + ']'); - } - } - - /** - * @ignore - */ - _writeHeader() { - this._buffer.position = this._startPos; - // type code - this._buffer.writeByte(BinaryUtils.TYPE_CODE.COMPLEX_OBJECT); - // version - this._buffer.writeByte(VERSION); - // flags - let flags = FLAG_USER_TYPE; - if (this._hasSchema) { - flags = flags | FLAG_HAS_SCHEMA | FLAG_COMPACT_FOOTER; - } - if (this._offsetType === BinaryUtils.TYPE_CODE.BYTE) { - flags = flags | FLAG_OFFSET_ONE_BYTE; - } - else if (this._offsetType === BinaryUtils.TYPE_CODE.SHORT) { - flags = flags | FLAG_OFFSET_TWO_BYTES; - } - this._buffer.writeShort(flags); - // type id - this._buffer.writeInteger(this._typeBuilder.getTypeId()); - // hash code - this._buffer.writeInteger(BinaryUtils.contentHashCode( - this._buffer, this._startPos + HEADER_LENGTH, this._schemaOffset - 1)); - // length - this._buffer.writeInteger(this._length); - // schema id - this._buffer.writeInteger(this._hasSchema ? this._typeBuilder.getSchemaId() : 0); - // schema offset - this._buffer.writeInteger(this._schemaOffset); - } - - /** - * @ignore - */ - async _read(communicator) { - await this._readHeader(communicator); - if (this._hasSchema) { - this._buffer.position = this._startPos + this._schemaOffset; - const fieldOffsets = new Array(); - const fieldIds = this._typeBuilder._schema.fieldIds; - let index = 0; - let fieldId; - let schemaEndOffset = this._startPos + this._length; - if (this._hasRawData) { - schemaEndOffset -= BinaryUtils.getSize(BinaryUtils.TYPE_CODE.INTEGER); - } - while (this._buffer.position < schemaEndOffset) { - if (!this._compactFooter) { - fieldId = this._buffer.readInteger(); - this._typeBuilder._schema.addField(fieldId); - } - else { - if (index >= fieldIds.length) { - throw Errors.IgniteClientError.serializationError( - false, 'wrong number of fields in schema'); - } - fieldId = fieldIds[index]; - index++; - } - fieldOffsets.push([fieldId, this._buffer.readNumber(this._offsetType, false)]); - } - fieldOffsets.sort((val1, val2) => val1[1] - val2[1]); - let offset; - let nextOffset; - let field; - for (let i = 0; i < fieldOffsets.length; i++) { - fieldId = fieldOffsets[i][0]; - offset = fieldOffsets[i][1]; - nextOffset = i + 1 < fieldOffsets.length ? fieldOffsets[i + 1][1] : this._schemaOffset; - field = BinaryObjectField._fromBuffer( - communicator,this._buffer, this._startPos + offset, nextOffset - offset, fieldId); - this._fields.set(field.id, field); - } - } - this._buffer.position = this._startPos + this._length; - } - - /** - * @ignore - */ - async _readHeader(communicator) { - // type code - this._buffer.readByte(); - // version - const version = this._buffer.readByte(); - if (version !== VERSION) { - throw Errors.IgniteClientError.internalError(); - } - // flags - const flags = this._buffer.readShort(); - // type id - const typeId = this._buffer.readInteger(); - // hash code - this._buffer.readInteger(); - // length - this._length = this._buffer.readInteger(); - // schema id - const schemaId = this._buffer.readInteger(); - // schema offset - this._schemaOffset = this._buffer.readInteger(); - this._hasSchema = BinaryObject._isFlagSet(flags, FLAG_HAS_SCHEMA); - this._compactFooter = BinaryObject._isFlagSet(flags, FLAG_COMPACT_FOOTER); - this._hasRawData = BinaryObject._isFlagSet(flags, FLAG_HAS_RAW_DATA); - this._offsetType = BinaryObject._isFlagSet(flags, FLAG_OFFSET_ONE_BYTE) ? - BinaryUtils.TYPE_CODE.BYTE : - BinaryObject._isFlagSet(flags, FLAG_OFFSET_TWO_BYTES) ? - BinaryUtils.TYPE_CODE.SHORT : - BinaryUtils.TYPE_CODE.INTEGER; - this._typeBuilder = await BinaryTypeBuilder.fromTypeId(communicator, typeId, this._compactFooter ? schemaId : null); - } -} - -/** - * @ignore - */ -class BinaryObjectField { - constructor(name, value = undefined, type = null) { - this._name = name; - this._id = BinaryField._calculateId(name); - this._value = value; - this._type = type; - if (!type && value !== undefined && value !== null) { - this._type = BinaryUtils.calcObjectType(value); - } - this._typeCode = null; - if (this._type) { - this._typeCode = BinaryUtils.getTypeCode(this._type); - } - } - - get id() { - return this._id; - } - - get typeCode() { - return this._typeCode; - } - - async getValue(type = null) { - if (this._value === undefined || this._buffer && this._type !== type) { - this._buffer.position = this._offset; - this._value = await this._communicator.readObject(this._buffer, type); - this._type = type; - } - return this._value; - } - - getOffsetType(headerStartPos) { - let offset = this._offset - headerStartPos; - if (offset < 0x100) { - return BinaryUtils.TYPE_CODE.BYTE; - } - else if (offset < 0x10000) { - return BinaryUtils.TYPE_CODE.SHORT; - } - return BinaryUtils.TYPE_CODE.INTEGER; - } - - static _fromBuffer(communicator, buffer, offset, length, id) { - const result = new BinaryObjectField(null); - result._id = id; - result._communicator = communicator; - result._buffer = buffer; - result._offset = offset; - result._length = length; - return result; - } - - async _writeValue(communicator, buffer, expectedTypeCode) { - const offset = buffer.position; - if (this._buffer && this._communicator === communicator) { - buffer.writeBuffer(this._buffer.buffer, this._offset, this._offset + this._length); - } - else { - if (this._value === undefined) { - await this.getValue(); - } - BinaryUtils.checkCompatibility(this._value, expectedTypeCode); - await communicator.writeObject(buffer, this._value, this._type); - } - this._communicator = communicator; - this._buffer = buffer; - this._length = buffer.position - offset; - this._offset = offset; - } - - _writeOffset(buffer, headerStartPos, offsetType) { - buffer.writeNumber(this._offset - headerStartPos, offsetType, false); - } -} - -module.exports = BinaryObject; diff --git a/modules/platforms/nodejs/lib/CacheClient.js b/modules/platforms/nodejs/lib/CacheClient.js deleted file mode 100644 index fad8e71d65da0..0000000000000 --- a/modules/platforms/nodejs/lib/CacheClient.js +++ /dev/null @@ -1,759 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -'use strict'; - -const BinaryUtils = require('./internal/BinaryUtils'); -const ArgumentChecker = require('./internal/ArgumentChecker'); -const SqlQuery = require('./Query').SqlQuery; -const SqlFieldsQuery = require('./Query').SqlFieldsQuery; -const ScanQuery = require('./Query').ScanQuery; - -/** - * Peek modes - * @typedef CacheClient.PEEK_MODE - * @enum - * @readonly - * @property ALL 0 - * @property NEAR 1 - * @property PRIMARY 2 - * @property BACKUP 3 - */ -const PEEK_MODE = Object.freeze({ - ALL : 0, - NEAR : 1, - PRIMARY : 2, - BACKUP : 3 -}); - -/** - * Class representing and providing access to Ignite cache. - * - * The class has no public constructor. An instance of this class should be obtained - * via the methods of {@link IgniteClient} objects. - * One instance of this class provides access to one Ignite cache which is specified - * during the instance obtaining and cannot be changed after that. - * - * There are three groups of methods in the cache client: - * - methods to configure the cache client - * - methods to operate with the cache using Key-Value Queries - * - methods to operate with the cache using SQL and Scan Queries - * - * @hideconstructor - */ -class CacheClient { - - static get PEEK_MODE() { - return PEEK_MODE; - } - - /* Methods to configure the cache client */ - - /** - * Specifies a type of the cache key. - * - * The cache client assumes that keys in all further operations with the cache - * will have the specified type. - * Eg. the cache client will convert keys provided as input parameters of the methods - * to the specified object type before sending them to a server. - * - * After the cache client creation a type of the cache key is not specified (null). - * - * If the type is not specified then during operations the cache client - * will do automatic mapping between some of the JavaScript types and object types - - * according to the mapping table defined in the description of the {@link ObjectType} class. - * - * @param {ObjectType.PRIMITIVE_TYPE | CompositeType} type - type of the keys in the cache: - * - either a type code of primitive (simple) type - * - or an instance of class representing non-primitive (composite) type - * - or null (means the type is not specified). - * - * @return {CacheClient} - the same instance of the cache client. - * - * @throws {IgniteClientError} if error. - */ - setKeyType(type) { - BinaryUtils.checkObjectType(type, 'type'); - this._keyType = type; - return this; - } - - /** - * Specifies a type of the cache value. - * - * The cache client assumes that values in all further operations with the cache - * will have the specified type. - * Eg. the cache client will convert values provided as input parameters of the methods - * to the specified object type before sending them to a server. - * - * After the cache client creation a type of the cache value is not specified (null). - * - * If the type is not specified then during operations the cache client - * will do automatic mapping between some of the JavaScript types and object types - - * according to the mapping table defined in the description of the {@link ObjectType} class. - * - * @param {ObjectType.PRIMITIVE_TYPE | CompositeType} type - type of the values in the cache: - * - either a type code of primitive (simple) type - * - or an instance of class representing non-primitive (composite) type - * - or null (means the type is not specified). - * - * @return {CacheClient} - the same instance of the cache client. - * - * @throws {IgniteClientError} if error. - */ - setValueType(type) { - BinaryUtils.checkObjectType(type, 'type'); - this._valueType = type; - return this; - } - - /* Methods to operate with the cache using Key-Value Queries */ - - /** - * Retrieves a value associated with the specified key from the cache. - * - * @async - * - * @param {*} key - key. - * - * @return {Promise<*>} - value associated with the specified key, or null if it does not exist. - * - * @throws {IgniteClientError} if error. - */ - async get(key) { - return await this._writeKeyReadValueOp(BinaryUtils.OPERATION.CACHE_GET, key); - } - - /** - * Retrieves entries associated with the specified keys from the cache. - * - * @async - * - * @param {Array<*>} keys - keys. - * - * @return {Promise>} - the retrieved entries (key-value pairs). - * Entries with the keys which do not exist in the cache are not included into the array. - * - * @throws {IgniteClientError} if error. - */ - async getAll(keys) { - ArgumentChecker.notEmpty(keys, 'keys'); - ArgumentChecker.hasType(keys, 'keys', false, Array); - let result = null; - await this._communicator.send( - BinaryUtils.OPERATION.CACHE_GET_ALL, - async (payload) => { - this._writeCacheInfo(payload); - await this._writeKeys(payload, keys); - }, - async (payload) => { - const resultCount = payload.readInteger(); - result = new Array(resultCount); - for (let i = 0; i < resultCount; i++) { - result[i] = new CacheEntry( - await this._communicator.readObject(payload, this._getKeyType()), - await this._communicator.readObject(payload, this._getValueType())); - } - }); - return result; - } - - /** - * Associates the specified value with the specified key in the cache. - * - * Overwrites the previous value if the key exists in the cache, - * otherwise creates new entry (key-value pair). - * - * @async - * - * @param {*} key - key. - * @param {*} value - value to be associated with the specified key. - * - * @throws {IgniteClientError} if error. - */ - async put(key, value) { - await this._writeKeyValueOp(BinaryUtils.OPERATION.CACHE_PUT, key, value); - } - - /** - * Associates the specified values with the specified keys in the cache. - * - * Overwrites the previous value if a key exists in the cache, - * otherwise creates new entry (key-value pair). - * - * @async - * - * @param {Array} entries - entries (key-value pairs) to be put into the cache. - * - * @throws {IgniteClientError} if error. - */ - async putAll(entries) { - ArgumentChecker.notEmpty(entries, 'entries'); - ArgumentChecker.hasType(entries, 'entries', true, CacheEntry); - await this._communicator.send( - BinaryUtils.OPERATION.CACHE_PUT_ALL, - async (payload) => { - this._writeCacheInfo(payload); - payload.writeInteger(entries.length); - for (let entry of entries) { - await this._writeKeyValue(payload, entry.getKey(), entry.getValue()); - } - }); - } - - /** - * Checks if the specified key exists in the cache. - * - * @async - * - * @param {*} key - key to check. - * - * @return {Promise} - true if the key exists, false otherwise. - * - * @throws {IgniteClientError} if error. - */ - async containsKey(key) { - return await this._writeKeyReadBooleanOp(BinaryUtils.OPERATION.CACHE_CONTAINS_KEY, key); - } - - /** - * Checks if all the specified keys exist in the cache. - * - * @async - * - * @param {Array<*>} keys - keys to check. - * - * @return {Promise} - true if all the keys exist, - * false if at least one of the keys does not exist in the cache. - * - * @throws {IgniteClientError} if error. - */ - async containsKeys(keys) { - return await this._writeKeysReadBooleanOp(BinaryUtils.OPERATION.CACHE_CONTAINS_KEYS, keys); - } - - /** - * Associates the specified value with the specified key in the cache - * and returns the previous associated value, if any. - * - * Overwrites the previous value if the key exists in the cache, - * otherwise creates new entry (key-value pair). - * - * @async - * - * @param {*} key - key. - * @param {*} value - value to be associated with the specified key. - * - * @return {Promise<*>} - the previous value associated with the specified key, or null if it did not exist. - * - * @throws {IgniteClientError} if error. - */ - async getAndPut(key, value) { - return await this._writeKeyValueReadValueOp(BinaryUtils.OPERATION.CACHE_GET_AND_PUT, key, value); - } - - /** - * Associates the specified value with the specified key in the cache - * and returns the previous associated value, if the key exists in the cache. - * Otherwise does nothing and returns null. - * - * @async - * - * @param {*} key - key. - * @param {*} value - value to be associated with the specified key. - * - * @return {Promise<*>} - the previous value associated with the specified key, or null if it did not exist. - * - * @throws {IgniteClientError} if error. - */ - async getAndReplace(key, value) { - return await this._writeKeyValueReadValueOp(BinaryUtils.OPERATION.CACHE_GET_AND_REPLACE, key, value); - } - - /** - * Removes the cache entry with the specified key - * and returns the last associated value, if any. - * - * @async - * - * @param {*} key - key of the entry to be removed. - * - * @return {Promise<*>} - the last value associated with the specified key, or null if it did not exist. - * - * @throws {IgniteClientError} if error. - */ - async getAndRemove(key) { - return await this._writeKeyReadValueOp(BinaryUtils.OPERATION.CACHE_GET_AND_REMOVE, key); - } - - /** - * Creates new entry (key-value pair) if the specified key does not exist in the cache. - * Otherwise does nothing. - * - * @async - * - * @param {*} key - key. - * @param {*} value - value to be associated with the specified key. - * - * @return {Promise} - true if the operation has been done, false otherwise. - * - * @throws {IgniteClientError} if error. - */ - async putIfAbsent(key, value) { - return await this._writeKeyValueReadBooleanOp(BinaryUtils.OPERATION.CACHE_PUT_IF_ABSENT, key, value); - } - - /** - * Creates new entry (key-value pair) if the specified key does not exist in the cache. - * Otherwise returns the current value associated with the existing key. - * - * @async - * - * @param {*} key - key. - * @param {*} value - value to be associated with the specified key. - * - * @return {Promise<*>} - the current value associated with the key if it already exists in the cache, - * null if the new entry is created. - * - * @throws {IgniteClientError} if error. - */ - async getAndPutIfAbsent(key, value) { - return await this._writeKeyValueReadValueOp(BinaryUtils.OPERATION.CACHE_GET_AND_PUT_IF_ABSENT, key, value); - } - - /** - * Associates the specified value with the specified key, if the key exists in the cache. - * Otherwise does nothing. - * - * @async - * - * @param {*} key - key. - * @param {*} value - value to be associated with the specified key. - * - * @return {Promise} - true if the operation has been done, false otherwise. - * - * @throws {IgniteClientError} if error. - */ - async replace(key, value) { - return await this._writeKeyValueReadBooleanOp(BinaryUtils.OPERATION.CACHE_REPLACE, key, value); - } - - /** - * Associates the new value with the specified key, if the key exists in the cache - * and the current value equals to the provided one. - * Otherwise does nothing. - * - * @async - * - * @param {*} key - key. - * @param {*} value - value to be compared with the current value associated with the specified key. - * @param {*} newValue - new value to be associated with the specified key. - * - * @return {Promise} - true if the operation has been done, false otherwise. - * - * @throws {IgniteClientError} if error. - */ - async replaceIfEquals(key, value, newValue) { - ArgumentChecker.notNull(key, 'key'); - ArgumentChecker.notNull(value, 'value'); - ArgumentChecker.notNull(newValue, 'newValue'); - let result; - await this._communicator.send( - BinaryUtils.OPERATION.CACHE_REPLACE_IF_EQUALS, - async (payload) => { - this._writeCacheInfo(payload); - await this._writeKeyValue(payload, key, value); - await this._communicator.writeObject(payload, newValue, this._getValueType()); - }, - async (payload) => { - result = payload.readBoolean(); - }); - return result; - } - - /** - * Removes all entries from the cache, without notifying listeners and cache writers. - * - * @async - * - * @throws {IgniteClientError} if error. - */ - async clear() { - await this._communicator.send( - BinaryUtils.OPERATION.CACHE_CLEAR, - async (payload) => { - this._writeCacheInfo(payload); - }); - } - - /** - * Removes entry with the specified key from the cache, without notifying listeners and cache writers. - * - * @async - * - * @param {*} key - key to be removed. - * - * @throws {IgniteClientError} if error. - */ - async clearKey(key) { - await this._writeKeyOp(BinaryUtils.OPERATION.CACHE_CLEAR_KEY, key); - } - - /** - * Removes entries with the specified keys from the cache, without notifying listeners and cache writers. - * - * @async - * - * @param {Array<*>} keys - keys to be removed. - * - * @throws {IgniteClientError} if error. - */ - async clearKeys(keys) { - await this._writeKeysOp(BinaryUtils.OPERATION.CACHE_CLEAR_KEYS, keys); - } - - /** - * Removes entry with the specified key from the cache, notifying listeners and cache writers. - * - * @async - * - * @param {*} key - key to be removed. - * - * @return {Promise} - true if the operation has been done, false otherwise. - * - * @throws {IgniteClientError} if error. - */ - async removeKey(key) { - return await this._writeKeyReadBooleanOp(BinaryUtils.OPERATION.CACHE_REMOVE_KEY, key); - } - - /** - * Removes entry with the specified key from the cache, if the current value equals to the provided one. - * Notifies listeners and cache writers. - * - * @async - * - * @param {*} key - key to be removed. - * @param {*} value - value to be compared with the current value associated with the specified key. - * - * @return {Promise} - true if the operation has been done, false otherwise. - * - * @throws {IgniteClientError} if error. - */ - async removeIfEquals(key, value) { - return await this._writeKeyValueReadBooleanOp(BinaryUtils.OPERATION.CACHE_REMOVE_IF_EQUALS, key, value); - } - - /** - * Removes entries with the specified keys from the cache, notifying listeners and cache writers. - * - * @async - * - * @param {Array<*>} keys - keys to be removed. - * - * @throws {IgniteClientError} if error. - */ - async removeKeys(keys) { - await this._writeKeysOp(BinaryUtils.OPERATION.CACHE_REMOVE_KEYS, keys); - } - - /** - * Removes all entries from the cache, notifying listeners and cache writers. - * - * @async - * - * @throws {IgniteClientError} if error. - */ - async removeAll() { - await this._communicator.send( - BinaryUtils.OPERATION.CACHE_REMOVE_ALL, - async (payload) => { - this._writeCacheInfo(payload); - }); - } - - /** - * Returns the number of the entries in the cache. - * - * @async - * - * @param {...CacheClient.PEEK_MODE} [peekModes] - peek modes. - * - * @return {Promise} - the number of the entries in the cache. - * - * @throws {IgniteClientError} if error. - */ - async getSize(...peekModes) { - ArgumentChecker.hasValueFrom(peekModes, 'peekModes', true, CacheClient.PEEK_MODE); - let result; - await this._communicator.send( - BinaryUtils.OPERATION.CACHE_GET_SIZE, - async (payload) => { - this._writeCacheInfo(payload); - payload.writeInteger(peekModes.length); - for (let mode of peekModes) { - payload.writeByte(mode); - } - }, - async (payload) => { - result = payload.readLong().toNumber(); - }); - return result; - } - - /* Methods to operate with the cache using SQL and Scan Queries */ - - /** - * Starts an SQL or Scan query operation. - * - * @async - * - * @param {SqlQuery | SqlFieldsQuery | ScanQuery} query - query to be executed. - * - * @return {Promise} - cursor to obtain the results of the query operation: - * - {@link SqlFieldsCursor} in case of {@link SqlFieldsQuery} query - * - {@link Cursor} in case of other types of query - * - * @throws {IgniteClientError} if error. - */ - async query(query) { - ArgumentChecker.notNull(query, 'query'); - ArgumentChecker.hasType(query, 'query', false, SqlQuery, SqlFieldsQuery, ScanQuery); - - let value = null; - await this._communicator.send( - query._operation, - async (payload) => { - this._writeCacheInfo(payload); - await query._write(this._communicator, payload); - }, - async (payload) => { - value = await query._getCursor(this._communicator, payload, this._keyType, this._valueType); - }); - return value; - } - - /** Private methods */ - - /** - * @ignore - */ - constructor(name, config, communicator) { - this._name = name; - this._cacheId = CacheClient._calculateId(this._name); - this._config = config; - this._keyType = null; - this._valueType = null; - this._communicator = communicator; - } - - /** - * @ignore - */ - static _calculateId(name) { - return BinaryUtils.hashCode(name); - } - - /** - * @ignore - */ - _writeCacheInfo(payload) { - payload.writeInteger(this._cacheId); - payload.writeByte(0); - } - - /** - * @ignore - */ - async _writeKeyValue(payload, key, value) { - await this._communicator.writeObject(payload, key, this._getKeyType()); - await this._communicator.writeObject(payload, value, this._getValueType()); - } - - /** - * @ignore - */ - async _writeKeys(payload, keys) { - payload.writeInteger(keys.length); - for (let key of keys) { - await this._communicator.writeObject(payload, key, this._getKeyType()); - } - } - - /** - * @ignore - */ - _getKeyType() { - return this._keyType; - } - - /** - * @ignore - */ - _getValueType() { - return this._valueType; - } - - /** - * @ignore - */ - async _writeKeyValueOp(operation, key, value, payloadReader = null) { - ArgumentChecker.notNull(key, 'key'); - ArgumentChecker.notNull(value, 'value'); - await this._communicator.send( - operation, - async (payload) => { - this._writeCacheInfo(payload); - await this._writeKeyValue(payload, key, value); - }, - payloadReader); - } - - /** - * @ignore - */ - async _writeKeyValueReadValueOp(operation, key, value) { - let result = null; - await this._writeKeyValueOp( - operation, key, value, - async (payload) => { - result = await this._communicator.readObject(payload, this._getValueType()); - }); - return result; - } - - /** - * @ignore - */ - async _writeKeyValueReadBooleanOp(operation, key, value) { - let result = false; - await this._writeKeyValueOp( - operation, key, value, - async (payload) => { - result = payload.readBoolean(); - }); - return result; - } - - /** - * @ignore - */ - async _writeKeyOp(operation, key, payloadReader = null) { - ArgumentChecker.notNull(key, 'key'); - await this._communicator.send( - operation, - async (payload) => { - this._writeCacheInfo(payload); - await this._communicator.writeObject(payload, key, this._getKeyType()); - }, - payloadReader); - } - - /** - * @ignore - */ - async _writeKeyReadValueOp(operation, key) { - let value = null; - await this._writeKeyOp( - operation, key, - async (payload) => { - value = await this._communicator.readObject(payload, this._getValueType()); - }); - return value; - } - - /** - * @ignore - */ - async _writeKeyReadBooleanOp(operation, key) { - let result = false; - await this._writeKeyOp( - operation, key, - async (payload) => { - result = payload.readBoolean(); - }); - return result; - } - - /** - * @ignore - */ - async _writeKeysOp(operation, keys, payloadReader = null) { - ArgumentChecker.notEmpty(keys, 'keys'); - ArgumentChecker.hasType(keys, 'keys', false, Array); - await this._communicator.send( - operation, - async (payload) => { - this._writeCacheInfo(payload); - await this._writeKeys(payload, keys); - }, - payloadReader); - } - - /** - * @ignore - */ - async _writeKeysReadBooleanOp(operation, keys) { - let result = false; - await this._writeKeysOp( - operation, keys, - async (payload) => { - result = payload.readBoolean(); - }); - return result; - } -} - -/** - * A cache entry (key-value pair). - */ -class CacheEntry { - - /** - * Public constructor. - * - * @param {*} key - key corresponding to this entry. - * @param {*} value - value associated with the key. - * - * @return {CacheEntry} - new CacheEntry instance - */ - constructor(key, value) { - this._key = key; - this._value = value; - } - - /** - * Returns the key corresponding to this entry. - * - * @return {*} - the key corresponding to this entry. - */ - getKey() { - return this._key; - } - - /** - * Returns the value corresponding to this entry. - * - * @return {*} - the value corresponding to this entry. - */ - getValue() { - return this._value; - } -} - -module.exports = CacheClient; -module.exports.CacheEntry = CacheEntry; diff --git a/modules/platforms/nodejs/lib/CacheConfiguration.js b/modules/platforms/nodejs/lib/CacheConfiguration.js deleted file mode 100644 index 75f0155664206..0000000000000 --- a/modules/platforms/nodejs/lib/CacheConfiguration.js +++ /dev/null @@ -1,1734 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -'use strict'; - -const ComplexObjectType = require('./ObjectType').ComplexObjectType; -const ObjectArrayType = require('./ObjectType').ObjectArrayType; -const BinaryUtils = require('./internal/BinaryUtils'); -const BinaryCommunicator = require('./internal/BinaryCommunicator'); -const ArgumentChecker = require('./internal/ArgumentChecker'); -const Errors = require('./Errors'); - -/** - * Class representing Cache Key part of Ignite {@link CacheConfiguration}. - * - * All configuration settings are optional and have defaults which are defined on a server side. - * - * See Apache Ignite documentation for details of every configuration setting. - */ -class CacheKeyConfiguration { - - /** - * Public constructor. - * - * @param {string} [typeName=null] - * @param {string} [affinityKeyFieldName=null] - * - * @return {CacheKeyConfiguration} - new CacheKeyConfiguration instance. - */ - constructor(typeName = null, affinityKeyFieldName = null) { - this._typeName = typeName; - this._affinityKeyFieldName = affinityKeyFieldName; - } - - /** - * - * - * @param {string} typeName - * - * @return {CacheKeyConfiguration} - the same instance of the CacheKeyConfiguration. - */ - setTypeName(typeName) { - this._typeName = typeName; - return this; - } - - /** - * - * - * @return {string} - */ - getTypeName() { - return this._typeName; - } - - /** - * - * - * @param {string} affinityKeyFieldName - * - * @return {CacheKeyConfiguration} - the same instance of the CacheKeyConfiguration. - */ - setAffinityKeyFieldName(affinityKeyFieldName) { - this._affinityKeyFieldName = affinityKeyFieldName; - return this; - } - - /** - * - * - * @return {string} - */ - getAffinityKeyFieldName() { - return this._affinityKeyFieldName; - } - - /** Private methods */ - - /** - * @ignore - */ - async _write(communicator, buffer) { - BinaryCommunicator.writeString(buffer, this._typeName); - BinaryCommunicator.writeString(buffer, this._affinityKeyFieldName); - } - - /** - * @ignore - */ - async _read(communicator, buffer) { - this._typeName = BinaryCommunicator.readString(buffer); - this._affinityKeyFieldName = BinaryCommunicator.readString(buffer); - } -} - -/** - * Class representing one Query Entity element of Ignite {@link CacheConfiguration}. - * - * All configuration settings are optional and have defaults which are defined on a server side. - * - * See Apache Ignite documentation for details of every configuration setting. - */ -class QueryEntity { - - /** - * Public constructor. - * - * @return {QueryEntity} - new QueryEntity instance. - */ - constructor() { - this._keyTypeName = null; - this._valueTypeName = null; - this._tableName = null; - this._keyFieldName = null; - this._valueFieldName = null; - this._fields = null; - this._aliases = null; - this._indexes = null; - } - - /** - * - * - * @param {string} keyTypeName - * - * @return {QueryEntity} - the same instance of the QueryEntity. - */ - setKeyTypeName(keyTypeName) { - this._keyTypeName = keyTypeName; - return this; - } - - /** - * - * - * @return {string} - */ - getKeyTypeName() { - return this._keyTypeName; - } - - /** - * - * - * @param {string} valueTypeName - * - * @return {QueryEntity} - the same instance of the QueryEntity. - */ - setValueTypeName(valueTypeName) { - this._valueTypeName = valueTypeName; - return this; - } - - /** - * - * - * @return {string} - */ - getValueTypeName() { - return this._valueTypeName; - } - - /** - * - * - * @param {string} tableName - * - * @return {QueryEntity} - the same instance of the QueryEntity. - */ - setTableName(tableName) { - this._tableName = tableName; - return this; - } - - /** - * - * - * @return {string} - */ - getTableName() { - return this._tableName; - } - - /** - * - * - * @param {string} keyFieldName - * - * @return {QueryEntity} - the same instance of the QueryEntity. - */ - setKeyFieldName(keyFieldName) { - this._keyFieldName = keyFieldName; - return this; - } - - /** - * - * - * @return {string} - */ - getKeyFieldName() { - return this._keyFieldName; - } - - /** - * - * - * @param {string} valueFieldName - * - * @return {QueryEntity} - the same instance of the QueryEntity. - */ - setValueFieldName(valueFieldName) { - this._valueFieldName = valueFieldName; - return this; - } - - /** - * - * - * @return {string} - */ - getValueFieldName() { - return this._valueFieldName; - } - - /** - * - * - * @param {Array} fields - * - * @return {QueryEntity} - the same instance of the QueryEntity. - */ - setFields(fields) { - this._fields = fields; - return this; - } - - /** - * - * - * @return {Array} - */ - getFields() { - return this._fields; - } - - /** - * - * - * @param {Map} aliases - * - * @return {QueryEntity} - the same instance of the QueryEntity. - */ - setAliases(aliases) { - this._aliases = aliases; - return this; - } - - /** - * - * - * @return {Map} - */ - getAliases() { - return this._aliases; - } - - /** - * - * - * @param {Array} indexes - * - * @return {QueryEntity} - the same instance of the QueryEntity. - */ - setIndexes(indexes) { - this._indexes = indexes; - return this; - } - - /** - * - * - * @return {Array} - */ - getIndexes() { - return this._indexes; - } - - /** Private methods */ - - /** - * @ignore - */ - async _write(communicator, buffer) { - BinaryCommunicator.writeString(buffer, this._keyTypeName); - BinaryCommunicator.writeString(buffer, this._valueTypeName); - BinaryCommunicator.writeString(buffer, this._tableName); - BinaryCommunicator.writeString(buffer, this._keyFieldName); - BinaryCommunicator.writeString(buffer, this._valueFieldName); - await this._writeSubEntities(communicator, buffer, this._fields); - await this._writeAliases(communicator, buffer); - await this._writeSubEntities(communicator, buffer, this._indexes); - } - - /** - * @ignore - */ - async _writeAliases(communicator, buffer) { - const length = this._aliases ? this._aliases.size : 0; - buffer.writeInteger(length); - if (length > 0) { - for (let [key, value] of this._aliases.entries()) { - BinaryCommunicator.writeString(buffer, key); - BinaryCommunicator.writeString(buffer, value); - } - } - } - - /** - * @ignore - */ - async _writeSubEntities(communicator, buffer, entities) { - const length = entities ? entities.length : 0; - buffer.writeInteger(length); - if (length > 0) { - for (let entity of entities) { - await entity._write(communicator, buffer); - } - } - } - - /** - * @ignore - */ - async _read(communicator, buffer) { - this._keyTypeName = await communicator.readObject(buffer); - this._valueTypeName = await communicator.readObject(buffer); - this._tableName = await communicator.readObject(buffer); - this._keyFieldName = await communicator.readObject(buffer); - this._valueFieldName = await communicator.readObject(buffer); - this._fields = await this._readSubEntities(communicator, buffer, QueryField); - await this._readAliases(communicator, buffer); - this._indexes = await this._readSubEntities(communicator, buffer, QueryIndex); - } - - /** - * @ignore - */ - async _readSubEntities(communicator, buffer, objectConstructor) { - const length = buffer.readInteger(buffer); - const result = new Array(length); - if (length > 0) { - let res; - for (let i = 0; i < length; i++) { - res = new objectConstructor(); - await res._read(communicator, buffer); - result[i] = res; - } - } - return result; - } - - /** - * @ignore - */ - async _readAliases(communicator, buffer) { - const length = buffer.readInteger(buffer); - this._aliases = new Map(); - if (length > 0) { - let res; - for (let i = 0; i < length; i++) { - this._aliases.set(await communicator.readObject(buffer), await communicator.readObject(buffer)); - } - } - } -} - -/** - * Class representing one Query Field element of {@link QueryEntity} of Ignite {@link CacheConfiguration}. - * - * All configuration settings are optional and have defaults which are defined on a server side. - * - * See Apache Ignite documentation for details of every configuration setting. - */ -class QueryField { - - /** - * Public constructor. - * - * @param {string} [name=null] - * @param {string} [typeName=null] - * - * @return {QueryField} - new QueryField instance. - */ - constructor(name = null, typeName = null) { - this._name = name; - this._typeName = typeName; - this._isKeyField = false; - this._isNotNull = false; - this._defaultValue = undefined; - this._precision = -1; - this._scale = -1; - this._valueType = null; - this._communicator = null; - this._buffer = null; - this._index = null; - } - - /** - * - * - * @param {string} name - * - * @return {QueryField} - the same instance of the QueryField. - */ - setName(name) { - this._name = name; - return this; - } - - /** - * - * - * @return {string} - */ - getName() { - return this._name; - } - - /** - * - * - * @param {string} typeName - * - * @return {QueryField} - the same instance of the QueryField. - */ - setTypeName(typeName) { - this._typeName = typeName; - return this; - } - - /** - * - * - * @return {string} - */ - getTypeName() { - return this._typeName; - } - - /** - * - * - * @param {boolean} isKeyField - * - * @return {QueryField} - the same instance of the QueryField. - */ - setIsKeyField(isKeyField) { - this._isKeyField = isKeyField; - return this; - } - - /** - * - * - * @return {boolean} - */ - getIsKeyField() { - return this._isKeyField; - } - - /** - * - * - * @param {boolean} isNotNull - * - * @return {QueryField} - the same instance of the QueryField. - */ - setIsNotNull(isNotNull) { - this._isNotNull = isNotNull; - return this; - } - - /** - * - * - * @return {boolean} - */ - getIsNotNull() { - return this._isNotNull; - } - - /** - * - * - * @param {*} defaultValue - * @param {ObjectType.PRIMITIVE_TYPE | CompositeType} [valueType=null] - type of the default value: - * - either a type code of primitive (simple) type - * - or an instance of class representing non-primitive (composite) type - * - or null (or not specified) that means the type is not specified - * - * @return {QueryField} - the same instance of the QueryField. - */ - setDefaultValue(defaultValue, valueType = null) { - this._defaultValue = defaultValue; - this._valueType = valueType; - return this; - } - - /** - * - * - * @param {ObjectType.PRIMITIVE_TYPE | CompositeType} [valueType=null] - type of the default value: - * - either a type code of primitive (simple) type - * - or an instance of class representing non-primitive (composite) type - * - or null (or not specified) that means the type is not specified - * - * @async - * - * @return {*} - */ - async getDefaultValue(valueType = null) { - if (this._defaultValue === undefined) { - if (this._buffer) { - const position = this._buffer.position; - this._buffer.position = this._index; - const result = await this._communicator.readObject(this._buffer, valueType); - this._buffer.position = position; - return result; - } - else { - return null; - } - } - else { - return this._defaultValue; - } - } - - /** - * - * - * @param {number} precision - * - * @return {QueryField} - the same instance of the QueryField. - */ - setPrecision(precision) { - ArgumentChecker.isInteger(precision, 'precision'); - this._precision = precision; - return this; - } - - /** - * - * - * @return {number} - */ - getPrecision() { - return this._precision; - } - - /** - * - * - * @param {number} scale - * - * @return {QueryField} - the same instance of the QueryField. - */ - setScale(scale) { - ArgumentChecker.isInteger(scale, 'scale'); - this._scale = scale; - return this; - } - - /** - * - * - * @return {number} - */ - getScale() { - return this._scale; - } - - /** Private methods */ - - /** - * @ignore - */ - async _write(communicator, buffer) { - BinaryCommunicator.writeString(buffer, this._name); - BinaryCommunicator.writeString(buffer, this._typeName); - buffer.writeBoolean(this._isKeyField); - buffer.writeBoolean(this._isNotNull); - await communicator.writeObject(buffer, this._defaultValue ? this._defaultValue : null, this._valueType); - buffer.writeInteger(this._precision); - buffer.writeInteger(this._scale); - } - - /** - * @ignore - */ - async _read(communicator, buffer) { - this._name = await communicator.readObject(buffer); - this._typeName = await communicator.readObject(buffer); - this._isKeyField = buffer.readBoolean(); - this._isNotNull = buffer.readBoolean(); - this._defaultValue = undefined; - this._communicator = communicator; - this._buffer = buffer; - this._index = buffer.position; - await communicator.readObject(buffer); - this._precision = buffer.readInteger(); - this._scale = buffer.readInteger(); - } -} - -/** - * - * @typedef QueryIndex.INDEX_TYPE - * @enum - * @readonly - * @property SORTED 0 - * @property FULLTEXT 1 - * @property GEOSPATIAL 2 - */ - const INDEX_TYPE = Object.freeze({ - SORTED : 0, - FULLTEXT : 1, - GEOSPATIAL : 2 -}); - -/** - * Class representing one Query Index element of {@link QueryEntity} of Ignite {@link CacheConfiguration}. - * - * All configuration settings are optional and have defaults which are defined on a server side. - * - * See Apache Ignite documentation for details of every configuration setting. - */ -class QueryIndex { - - /** - * Public constructor. - * - * @param {string} [name=null] - * @param {string} [typeName=QueryIndex.INDEX_TYPE.SORTED] - * - * @return {QueryIndex} - new QueryIndex instance. - */ - constructor(name = null, type = QueryIndex.INDEX_TYPE.SORTED) { - this._name = name; - this.setType(type); - this._inlineSize = -1; - this._fields = null; - } - - static get INDEX_TYPE() { - return INDEX_TYPE; - } - - /** - * - * - * @param {string} name - * - * @return {QueryIndex} - the same instance of the QueryIndex. - */ - setName(name) { - this._name = name; - return this; - } - - /** - * - * - * @return {string} - */ - getName() { - return this._name; - } - - /** - * - * - * @param {QueryIndex.INDEX_TYPE} type - * - * @return {QueryIndex} - the same instance of the QueryIndex. - * - * @throws {IgniteClientError} if error. - */ - setType(type) { - ArgumentChecker.hasValueFrom(type, 'type', false, QueryIndex.INDEX_TYPE); - this._type = type; - return this; - } - - /** - * - * - * @return {QueryIndex.INDEX_TYPE} - */ - getType() { - return this._type; - } - - /** - * - * - * @param {number} inlineSize - * - * @return {QueryIndex} - the same instance of the QueryIndex. - */ - setInlineSize(inlineSize) { - this._inlineSize = inlineSize; - return this; - } - - /** - * - * - * @return {number} - */ - getInlineSize() { - return this._inlineSize; - } - - /** - * - * - * @param {Map} fields - * - * @return {QueryIndex} - the same instance of the QueryIndex. - */ - setFields(fields) { - this._fields = fields; - return this; - } - - /** - * - * - * @return {Map} - */ - getFields() { - return this._fields; - } - - /** Private methods */ - - /** - * @ignore - */ - async _write(communicator, buffer) { - BinaryCommunicator.writeString(buffer, this._name); - buffer.writeByte(this._type); - buffer.writeInteger(this._inlineSize); - // write fields - const length = this._fields ? this._fields.size : 0; - buffer.writeInteger(length); - if (length > 0) { - for (let [key, value] of this._fields.entries()) { - BinaryCommunicator.writeString(buffer, key); - buffer.writeBoolean(value); - } - } - } - - /** - * @ignore - */ - async _read(communicator, buffer) { - this._name = await communicator.readObject(buffer); - this._type = buffer.readByte(); - this._inlineSize = buffer.readInteger(); - // read fields - const length = buffer.readInteger(buffer); - this._fields = new Map(); - if (length > 0) { - let res; - for (let i = 0; i < length; i++) { - this._fields.set(await communicator.readObject(buffer), buffer.readBoolean()); - } - } - } -} - -const PROP_NAME = 0; -const PROP_CACHE_MODE = 1; -const PROP_ATOMICITY_MODE = 2; -const PROP_BACKUPS = 3; -const PROP_WRITE_SYNCHRONIZATION_MODE = 4; -const PROP_COPY_ON_READ = 5; -const PROP_READ_FROM_BACKUP = 6; -const PROP_DATA_REGION_NAME = 100; -const PROP_IS_ONHEAP_CACHE_ENABLED = 101; -const PROP_QUERY_ENTITY = 200; -const PROP_QUERY_PARALLELISM = 201; -const PROP_QUERY_DETAIL_METRICS_SIZE = 202; -const PROP_SQL_SCHEMA = 203; -const PROP_SQL_INDEX_INLINE_MAX_SIZE = 204; -const PROP_SQL_ESCAPE_ALL = 205; -const PROP_MAX_QUERY_ITERATORS = 206; -const PROP_REBALANCE_MODE = 300; -const PROP_REBALANCE_DELAY = 301; -const PROP_REBALANCE_TIMEOUT = 302; -const PROP_REBALANCE_BATCH_SIZE = 303; -const PROP_REBALANCE_BATCHES_PREFETCH_COUNT = 304; -const PROP_REBALANCE_ORDER = 305; -const PROP_REBALANCE_THROTTLE = 306; -const PROP_GROUP_NAME = 400; -const PROP_CACHE_KEY_CONFIGURATION = 401; -const PROP_DEFAULT_LOCK_TIMEOUT = 402; -const PROP_MAX_CONCURRENT_ASYNC_OPS = 403; -const PROP_PARTITION_LOSS_POLICY = 404; -const PROP_EAGER_TTL = 405; -const PROP_STATISTICS_ENABLED = 406; - -const PROP_TYPES = Object.freeze({ - [PROP_NAME] : BinaryUtils.TYPE_CODE.STRING, - [PROP_CACHE_MODE] : BinaryUtils.TYPE_CODE.INTEGER, - [PROP_ATOMICITY_MODE] : BinaryUtils.TYPE_CODE.INTEGER, - [PROP_BACKUPS] : BinaryUtils.TYPE_CODE.INTEGER, - [PROP_WRITE_SYNCHRONIZATION_MODE] : BinaryUtils.TYPE_CODE.INTEGER, - [PROP_COPY_ON_READ] : BinaryUtils.TYPE_CODE.BOOLEAN, - [PROP_READ_FROM_BACKUP] : BinaryUtils.TYPE_CODE.BOOLEAN, - [PROP_DATA_REGION_NAME] : BinaryUtils.TYPE_CODE.STRING, - [PROP_IS_ONHEAP_CACHE_ENABLED] : BinaryUtils.TYPE_CODE.BOOLEAN, - [PROP_QUERY_ENTITY] : new ObjectArrayType(new ComplexObjectType(new QueryEntity())), - [PROP_QUERY_PARALLELISM] : BinaryUtils.TYPE_CODE.INTEGER, - [PROP_QUERY_DETAIL_METRICS_SIZE] : BinaryUtils.TYPE_CODE.INTEGER, - [PROP_SQL_SCHEMA] : BinaryUtils.TYPE_CODE.STRING, - [PROP_SQL_INDEX_INLINE_MAX_SIZE] : BinaryUtils.TYPE_CODE.INTEGER, - [PROP_SQL_ESCAPE_ALL] : BinaryUtils.TYPE_CODE.BOOLEAN, - [PROP_MAX_QUERY_ITERATORS] : BinaryUtils.TYPE_CODE.INTEGER, - [PROP_REBALANCE_MODE] : BinaryUtils.TYPE_CODE.INTEGER, - [PROP_REBALANCE_DELAY] : BinaryUtils.TYPE_CODE.LONG, - [PROP_REBALANCE_TIMEOUT] : BinaryUtils.TYPE_CODE.LONG, - [PROP_REBALANCE_BATCH_SIZE] : BinaryUtils.TYPE_CODE.INTEGER, - [PROP_REBALANCE_BATCHES_PREFETCH_COUNT] : BinaryUtils.TYPE_CODE.LONG, - [PROP_REBALANCE_ORDER] : BinaryUtils.TYPE_CODE.INTEGER, - [PROP_REBALANCE_THROTTLE] : BinaryUtils.TYPE_CODE.LONG, - [PROP_GROUP_NAME] : BinaryUtils.TYPE_CODE.STRING, - [PROP_CACHE_KEY_CONFIGURATION] : new ObjectArrayType(new ComplexObjectType(new CacheKeyConfiguration())), - [PROP_DEFAULT_LOCK_TIMEOUT] : BinaryUtils.TYPE_CODE.LONG, - [PROP_MAX_CONCURRENT_ASYNC_OPS] : BinaryUtils.TYPE_CODE.INTEGER, - [PROP_PARTITION_LOSS_POLICY] : BinaryUtils.TYPE_CODE.INTEGER, - [PROP_EAGER_TTL] : BinaryUtils.TYPE_CODE.BOOLEAN, - [PROP_STATISTICS_ENABLED] : BinaryUtils.TYPE_CODE.BOOLEAN -}); - -/** - * - * @typedef CacheConfiguration.CACHE_ATOMICITY_MODE - * @enum - * @readonly - * @property TRANSACTIONAL 0 - * @property ATOMIC 1 - */ -const CACHE_ATOMICITY_MODE = Object.freeze({ - TRANSACTIONAL : 0, - ATOMIC : 1 -}); - -/** - * - * @typedef CacheConfiguration.CACHE_MODE - * @enum - * @readonly - * @property LOCAL 0 - * @property REPLICATED 1 - * @property PARTITIONED 2 - */ -const CACHE_MODE = Object.freeze({ - LOCAL : 0, - REPLICATED : 1, - PARTITIONED : 2 -}); - -/** - * - * @typedef CacheConfiguration.PARTITION_LOSS_POLICY - * @enum - * @readonly - * @property READ_ONLY_SAFE 0 - * @property READ_ONLY_ALL 1 - * @property READ_WRITE_SAFE 2 - * @property READ_WRITE_ALL 3 - * @property IGNORE 4 - */ -const PARTITION_LOSS_POLICY = Object.freeze({ - READ_ONLY_SAFE : 0, - READ_ONLY_ALL : 1, - READ_WRITE_SAFE : 2, - READ_WRITE_ALL : 3, - IGNORE : 4 -}); - -/** - * - * @typedef CacheConfiguration.REABALANCE_MODE - * @enum - * @readonly - * @property SYNC 0 - * @property ASYNC 1 - * @property NONE 2 - */ -const REABALANCE_MODE = Object.freeze({ - SYNC : 0, - ASYNC : 1, - NONE : 2 -}); - -/** - * - * @typedef CacheConfiguration.WRITE_SYNCHRONIZATION_MODE - * @enum - * @readonly - * @property FULL_SYNC 0 - * @property FULL_ASYNC 1 - * @property PRIMARY_SYNC 2 - */ -const WRITE_SYNCHRONIZATION_MODE = Object.freeze({ - FULL_SYNC : 0, - FULL_ASYNC : 1, - PRIMARY_SYNC : 2 -}); - -/** - * Class representing Ignite cache configuration on a server. - * - * All configuration settings are optional and have defaults which are defined on a server side. - * - * See Apache Ignite documentation for details of every configuration setting. - */ -class CacheConfiguration { - - /** - * Public constructor. - * - * @return {CacheConfiguration} - new CacheConfiguration instance. - */ - constructor() { - this._properties = new Map(); - } - - static get CACHE_ATOMICITY_MODE() { - return CACHE_ATOMICITY_MODE; - } - - static get CACHE_MODE() { - return CACHE_MODE; - } - - static get PARTITION_LOSS_POLICY() { - return PARTITION_LOSS_POLICY; - } - - static get REABALANCE_MODE() { - return REABALANCE_MODE; - } - - static get WRITE_SYNCHRONIZATION_MODE() { - return WRITE_SYNCHRONIZATION_MODE; - } - - /** - * - * - * @param {CacheConfiguration.CACHE_ATOMICITY_MODE} atomicityMode - * - * @return {CacheConfiguration} - the same instance of the CacheConfiguration. - * - * @throws {IgniteClientError} if error. - */ - setAtomicityMode(atomicityMode) { - ArgumentChecker.hasValueFrom(atomicityMode, 'atomicityMode', false, CACHE_ATOMICITY_MODE); - this._properties.set(PROP_ATOMICITY_MODE, atomicityMode); - return this; - } - - /** - * - * - * @return {CacheConfiguration.CACHE_ATOMICITY_MODE} - */ - getAtomicityMode() { - return this._properties.get(PROP_ATOMICITY_MODE); - } - - /** - * - * - * @param {number} backups - * - * @return {CacheConfiguration} - the same instance of the CacheConfiguration. - */ - setBackups(backups) { - this._properties.set(PROP_BACKUPS, backups); - return this; - } - - /** - * - * - * @return {number} - */ - getBackups() { - return this._properties.get(PROP_BACKUPS); - } - - /** - * - * - * @param {CacheConfiguration.CACHE_MODE} cacheMode - * - * @return {CacheConfiguration} - the same instance of the CacheConfiguration. - * - * @throws {IgniteClientError} if error. - */ - setCacheMode(cacheMode) { - ArgumentChecker.hasValueFrom(cacheMode, 'cacheMode', false, CACHE_MODE); - this._properties.set(PROP_CACHE_MODE, cacheMode); - return this; - } - - /** - * - * - * @return {CacheConfiguration.CACHE_MODE} - */ - getCacheMode() { - return this._properties.get(PROP_CACHE_MODE); - } - - /** - * - * - * @param {boolean} copyOnRead - * - * @return {CacheConfiguration} - the same instance of the CacheConfiguration. - */ - setCopyOnRead(copyOnRead) { - this._properties.set(PROP_COPY_ON_READ, copyOnRead); - return this; - } - - /** - * - * - * @return {boolean} - */ - getCopyOnRead() { - return this._properties.get(PROP_COPY_ON_READ); - } - - /** - * - * - * @param {string} dataRegionName - * - * @return {CacheConfiguration} - the same instance of the CacheConfiguration. - */ - setDataRegionName(dataRegionName) { - this._properties.set(PROP_DATA_REGION_NAME, dataRegionName); - return this; - } - - /** - * - * - * @return {string} - */ - getDataRegionName() { - return this._properties.get(PROP_DATA_REGION_NAME); - } - - /** - * - * - * @param {boolean} eagerTtl - * - * @return {CacheConfiguration} - the same instance of the CacheConfiguration. - */ - setEagerTtl(eagerTtl) { - this._properties.set(PROP_EAGER_TTL, eagerTtl); - return this; - } - - /** - * - * - * @return {boolean} - */ - getEagerTtl() { - return this._properties.get(PROP_EAGER_TTL); - } - - /** - * - * - * @param {boolean} statisticsEnabled - * - * @return {CacheConfiguration} - the same instance of the CacheConfiguration. - */ - setStatisticsEnabled(statisticsEnabled) { - this._properties.set(PROP_STATISTICS_ENABLED, statisticsEnabled); - return this; - } - - /** - * - * - * @return {boolean} - */ - getStatisticsEnabled() { - return this._properties.get(PROP_STATISTICS_ENABLED); - } - - /** - * - * - * @param {string} groupName - * - * @return {CacheConfiguration} - the same instance of the CacheConfiguration. - */ - setGroupName(groupName) { - this._properties.set(PROP_GROUP_NAME, groupName); - return this; - } - - /** - * - * - * @return {string} - */ - getGroupName() { - return this._properties.get(PROP_GROUP_NAME); - } - - /** - * - * - * @param {number} lockTimeout - * - * @return {CacheConfiguration} - the same instance of the CacheConfiguration. - */ - setDefaultLockTimeout(lockTimeout) { - this._properties.set(PROP_DEFAULT_LOCK_TIMEOUT, lockTimeout); - return this; - } - - /** - * - * - * @return {number} - */ - getDefaultLockTimeout() { - return this._properties.get(PROP_DEFAULT_LOCK_TIMEOUT); - } - - /** - * - * - * @param {number} maxConcurrentAsyncOperations - * - * @return {CacheConfiguration} - the same instance of the CacheConfiguration. - */ - setMaxConcurrentAsyncOperations(maxConcurrentAsyncOperations) { - this._properties.set(PROP_MAX_CONCURRENT_ASYNC_OPS, maxConcurrentAsyncOperations); - return this; - } - - /** - * - * - * @return {number} - */ - getMaxConcurrentAsyncOperations() { - return this._properties.get(PROP_MAX_CONCURRENT_ASYNC_OPS); - } - - /** - * - * - * @param {number} maxQueryIterators - * - * @return {CacheConfiguration} - the same instance of the CacheConfiguration. - */ - setMaxQueryIterators(maxQueryIterators) { - this._properties.set(PROP_MAX_QUERY_ITERATORS, maxQueryIterators); - return this; - } - - /** - * - * - * @return {number} - */ - getMaxQueryIterators() { - return this._properties.get(PROP_MAX_QUERY_ITERATORS); - } - - /** - * - * - * @param {boolean} isOnheapCacheEnabled - * - * @return {CacheConfiguration} - the same instance of the CacheConfiguration. - */ - setIsOnheapCacheEnabled(isOnheapCacheEnabled) { - this._properties.set(PROP_IS_ONHEAP_CACHE_ENABLED, isOnheapCacheEnabled); - return this; - } - - /** - * - * - * @return {boolean} - */ - getIsOnheapCacheEnabled() { - return this._properties.get(PROP_IS_ONHEAP_CACHE_ENABLED); - } - - /** - * - * - * @param {CacheConfiguration.PARTITION_LOSS_POLICY} partitionLossPolicy - * - * @return {CacheConfiguration} - the same instance of the CacheConfiguration. - * - * @throws {IgniteClientError} if error. - */ - setPartitionLossPolicy(partitionLossPolicy) { - ArgumentChecker.hasValueFrom(partitionLossPolicy, 'partitionLossPolicy', false, PARTITION_LOSS_POLICY); - this._properties.set(PROP_PARTITION_LOSS_POLICY, partitionLossPolicy); - return this; - } - - /** - * - * - * @return {CacheConfiguration.PARTITION_LOSS_POLICY} - */ - getPartitionLossPolicy() { - return this._properties.get(PROP_PARTITION_LOSS_POLICY); - } - - /** - * - * - * @param {number} queryDetailMetricsSize - * - * @return {CacheConfiguration} - the same instance of the CacheConfiguration. - */ - setQueryDetailMetricsSize(queryDetailMetricsSize) { - this._properties.set(PROP_QUERY_DETAIL_METRICS_SIZE, queryDetailMetricsSize); - return this; - } - - /** - * - * - * @return {number} - */ - getQueryDetailMetricsSize() { - return this._properties.get(PROP_QUERY_DETAIL_METRICS_SIZE); - } - - /** - * - * - * @param {number} queryParallelism - * - * @return {CacheConfiguration} - the same instance of the CacheConfiguration. - */ - setQueryParallelism(queryParallelism) { - this._properties.set(PROP_QUERY_PARALLELISM, queryParallelism); - return this; - } - - /** - * - * - * @return {number} - */ - getQueryParallelism() { - return this._properties.get(PROP_QUERY_PARALLELISM); - } - - /** - * - * - * @param {boolean} readFromBackup - * - * @return {CacheConfiguration} - the same instance of the CacheConfiguration. - */ - setReadFromBackup(readFromBackup) { - this._properties.set(PROP_READ_FROM_BACKUP, readFromBackup); - return this; - } - - /** - * - * - * @return {boolean} - */ - getReadFromBackup() { - return this._properties.get(PROP_READ_FROM_BACKUP); - } - - /** - * - * - * @param {number} rebalanceBatchSize - * - * @return {CacheConfiguration} - the same instance of the CacheConfiguration. - */ - setRebalanceBatchSize(rebalanceBatchSize) { - this._properties.set(PROP_REBALANCE_BATCH_SIZE, rebalanceBatchSize); - return this; - } - - /** - * - * - * @return {number} - */ - getRebalanceBatchSize() { - return this._properties.get(PROP_REBALANCE_BATCH_SIZE); - } - - /** - * - * - * @param {number} rebalanceBatchesPrefetchCount - * - * @return {CacheConfiguration} - the same instance of the CacheConfiguration. - */ - setRebalanceBatchesPrefetchCount(rebalanceBatchesPrefetchCount) { - this._properties.set(PROP_REBALANCE_BATCHES_PREFETCH_COUNT, rebalanceBatchesPrefetchCount); - return this; - } - - /** - * - * - * @return {number} - */ - getRebalanceBatchesPrefetchCount() { - return this._properties.get(PROP_REBALANCE_BATCHES_PREFETCH_COUNT); - } - - /** - * - * - * @param {number} rebalanceDelay - * - * @return {CacheConfiguration} - the same instance of the CacheConfiguration. - */ - setRebalanceDelay(rebalanceDelay) { - this._properties.set(PROP_REBALANCE_DELAY, rebalanceDelay); - return this; - } - - /** - * - * - * @return {number} - */ - getRebalanceDelay() { - return this._properties.get(PROP_REBALANCE_DELAY); - } - - /** - * - * - * @param {CacheConfiguration.REABALANCE_MODE} rebalanceMode - * - * @return {CacheConfiguration} - the same instance of the CacheConfiguration. - * - * @throws {IgniteClientError} if error. - */ - setRebalanceMode(rebalanceMode) { - ArgumentChecker.hasValueFrom(rebalanceMode, 'rebalanceMode', false, REABALANCE_MODE); - this._properties.set(PROP_REBALANCE_MODE, rebalanceMode); - return this; - } - - /** - * - * - * @return {CacheConfiguration.REABALANCE_MODE} - */ - getRebalanceMode() { - return this._properties.get(PROP_REBALANCE_MODE); - } - - /** - * - * - * @param {number} rebalanceOrder - * - * @return {CacheConfiguration} - the same instance of the CacheConfiguration. - */ - setRebalanceOrder(rebalanceOrder) { - this._properties.set(PROP_REBALANCE_ORDER, rebalanceOrder); - return this; - } - - /** - * - * - * @return {number} - */ - getRebalanceOrder() { - return this._properties.get(PROP_REBALANCE_ORDER); - } - - /** - * - * - * @param {number} rebalanceThrottle - * - * @return {CacheConfiguration} - the same instance of the CacheConfiguration. - */ - setRebalanceThrottle(rebalanceThrottle) { - this._properties.set(PROP_REBALANCE_THROTTLE, rebalanceThrottle); - return this; - } - - /** - * - * - * @return {number} - */ - getRebalanceThrottle() { - return this._properties.get(PROP_REBALANCE_THROTTLE); - } - - /** - * - * - * @param {number} rebalanceTimeout - * - * @return {CacheConfiguration} - the same instance of the CacheConfiguration. - */ - setRebalanceTimeout(rebalanceTimeout) { - this._properties.set(PROP_REBALANCE_TIMEOUT, rebalanceTimeout); - return this; - } - - /** - * - * - * @return {number} - */ - getRebalanceTimeout() { - return this._properties.get(PROP_REBALANCE_TIMEOUT); - } - - /** - * - * - * @param {boolean} sqlEscapeAll - * - * @return {CacheConfiguration} - the same instance of the CacheConfiguration. - */ - setSqlEscapeAll(sqlEscapeAll) { - this._properties.set(PROP_SQL_ESCAPE_ALL, sqlEscapeAll); - return this; - } - - /** - * - * - * @return {boolean} - */ - getSqlEscapeAll() { - return this._properties.get(PROP_SQL_ESCAPE_ALL); - } - - /** - * - * - * @param {number} sqlIndexInlineMaxSize - * - * @return {CacheConfiguration} - the same instance of the CacheConfiguration. - */ - setSqlIndexInlineMaxSize(sqlIndexInlineMaxSize) { - this._properties.set(PROP_SQL_INDEX_INLINE_MAX_SIZE, sqlIndexInlineMaxSize); - return this; - } - - /** - * - * - * @return {number} - */ - getSqlIndexInlineMaxSize() { - return this._properties.get(PROP_SQL_INDEX_INLINE_MAX_SIZE); - } - - /** - * - * - * @param {string} sqlSchema - * - * @return {CacheConfiguration} - the same instance of the CacheConfiguration. - */ - setSqlSchema(sqlSchema) { - this._properties.set(PROP_SQL_SCHEMA, sqlSchema); - return this; - } - - /** - * - * - * @return {string} - */ - getSqlSchema() { - return this._properties.get(PROP_SQL_SCHEMA); - } - - /** - * - * - * @param {CacheConfiguration.WRITE_SYNCHRONIZATION_MODE} writeSynchronizationMode - * - * @return {CacheConfiguration} - the same instance of the CacheConfiguration. - * - * @throws {IgniteClientError} if error. - */ - setWriteSynchronizationMode(writeSynchronizationMode) { - ArgumentChecker.hasValueFrom(writeSynchronizationMode, 'writeSynchronizationMode', false, WRITE_SYNCHRONIZATION_MODE); - this._properties.set(PROP_WRITE_SYNCHRONIZATION_MODE, writeSynchronizationMode); - return this; - } - - /** - * - * - * @return {CacheConfiguration.WRITE_SYNCHRONIZATION_MODE} - */ - getWriteSynchronizationMode() { - return this._properties.get(PROP_WRITE_SYNCHRONIZATION_MODE); - } - - /** - * - * - * @param {...CacheKeyConfiguration} keyConfigurations - * - * @return {CacheConfiguration} - the same instance of the CacheConfiguration. - * - * @throws {IgniteClientError} if error. - */ - setKeyConfigurations(...keyConfigurations) { - ArgumentChecker.hasType(keyConfigurations, 'keyConfigurations', true, CacheKeyConfiguration); - this._properties.set(PROP_CACHE_KEY_CONFIGURATION, keyConfigurations); - return this; - } - - /** - * - * - * @return {Array} - */ - getKeyConfigurations() { - return this._properties.get(PROP_CACHE_KEY_CONFIGURATION); - } - - /** - * - * - * @param {...QueryEntity} queryEntities - * - * @return {CacheConfiguration} - the same instance of the CacheConfiguration. - * - * @throws {IgniteClientError} if error. - */ - setQueryEntities(...queryEntities) { - ArgumentChecker.hasType(queryEntities, 'queryEntities', true, QueryEntity); - this._properties.set(PROP_QUERY_ENTITY, queryEntities); - return this; - } - - /** - * - * - * @return {Array} - */ - getQueryEntities() { - return this._properties.get(PROP_QUERY_ENTITY); - } - - /** Private methods */ - - /** - * @ignore - */ - async _write(communicator, buffer, name) { - this._properties.set(PROP_NAME, name); - - const startPos = buffer.position; - buffer.position = buffer.position + - BinaryUtils.getSize(BinaryUtils.TYPE_CODE.INTEGER) + - BinaryUtils.getSize(BinaryUtils.TYPE_CODE.SHORT); - - for (let [propertyCode, property] of this._properties) { - await this._writeProperty(communicator, buffer, propertyCode, property); - } - - const length = buffer.position - startPos; - buffer.position = startPos; - - buffer.writeInteger(length); - buffer.writeShort(this._properties.size); - } - - /** - * @ignore - */ - async _writeProperty(communicator, buffer, propertyCode, property) { - buffer.writeShort(propertyCode); - const propertyType = PROP_TYPES[propertyCode]; - switch (BinaryUtils.getTypeCode(propertyType)) { - case BinaryUtils.TYPE_CODE.INTEGER: - case BinaryUtils.TYPE_CODE.LONG: - case BinaryUtils.TYPE_CODE.BOOLEAN: - await communicator.writeObject(buffer, property, propertyType, false); - return; - case BinaryUtils.TYPE_CODE.STRING: - await communicator.writeObject(buffer, property, propertyType); - return; - case BinaryUtils.TYPE_CODE.OBJECT_ARRAY: - const length = property ? property.length : 0; - buffer.writeInteger(length); - for (let prop of property) { - await prop._write(communicator, buffer); - } - return; - default: - throw Errors.IgniteClientError.internalError(); - } - } - - /** - * @ignore - */ - async _read(communicator, buffer) { - // length - buffer.readInteger(); - await this._readProperty(communicator, buffer, PROP_ATOMICITY_MODE); - await this._readProperty(communicator, buffer, PROP_BACKUPS); - await this._readProperty(communicator, buffer, PROP_CACHE_MODE); - await this._readProperty(communicator, buffer, PROP_COPY_ON_READ); - await this._readProperty(communicator, buffer, PROP_DATA_REGION_NAME); - await this._readProperty(communicator, buffer, PROP_EAGER_TTL); - await this._readProperty(communicator, buffer, PROP_STATISTICS_ENABLED); - await this._readProperty(communicator, buffer, PROP_GROUP_NAME); - await this._readProperty(communicator, buffer, PROP_DEFAULT_LOCK_TIMEOUT); - await this._readProperty(communicator, buffer, PROP_MAX_CONCURRENT_ASYNC_OPS); - await this._readProperty(communicator, buffer, PROP_MAX_QUERY_ITERATORS); - await this._readProperty(communicator, buffer, PROP_NAME); - await this._readProperty(communicator, buffer, PROP_IS_ONHEAP_CACHE_ENABLED); - await this._readProperty(communicator, buffer, PROP_PARTITION_LOSS_POLICY); - await this._readProperty(communicator, buffer, PROP_QUERY_DETAIL_METRICS_SIZE); - await this._readProperty(communicator, buffer, PROP_QUERY_PARALLELISM); - await this._readProperty(communicator, buffer, PROP_READ_FROM_BACKUP); - await this._readProperty(communicator, buffer, PROP_REBALANCE_BATCH_SIZE); - await this._readProperty(communicator, buffer, PROP_REBALANCE_BATCHES_PREFETCH_COUNT); - await this._readProperty(communicator, buffer, PROP_REBALANCE_DELAY); - await this._readProperty(communicator, buffer, PROP_REBALANCE_MODE); - await this._readProperty(communicator, buffer, PROP_REBALANCE_ORDER); - await this._readProperty(communicator, buffer, PROP_REBALANCE_THROTTLE); - await this._readProperty(communicator, buffer, PROP_REBALANCE_TIMEOUT); - await this._readProperty(communicator, buffer, PROP_SQL_ESCAPE_ALL); - await this._readProperty(communicator, buffer, PROP_SQL_INDEX_INLINE_MAX_SIZE); - await this._readProperty(communicator, buffer, PROP_SQL_SCHEMA); - await this._readProperty(communicator, buffer, PROP_WRITE_SYNCHRONIZATION_MODE); - await this._readProperty(communicator, buffer, PROP_CACHE_KEY_CONFIGURATION); - await this._readProperty(communicator, buffer, PROP_QUERY_ENTITY); - } - - /** - * @ignore - */ - async _readProperty(communicator, buffer, propertyCode) { - const propertyType = PROP_TYPES[propertyCode]; - switch (BinaryUtils.getTypeCode(propertyType)) { - case BinaryUtils.TYPE_CODE.INTEGER: - case BinaryUtils.TYPE_CODE.LONG: - case BinaryUtils.TYPE_CODE.BOOLEAN: - this._properties.set(propertyCode, await communicator._readTypedObject(buffer, propertyType)); - return; - case BinaryUtils.TYPE_CODE.STRING: - this._properties.set(propertyCode, await communicator.readObject(buffer, propertyType)); - return; - case BinaryUtils.TYPE_CODE.OBJECT_ARRAY: - const length = buffer.readInteger(); - if (length > 0) { - const properties = new Array(length); - for (let i = 0; i < length; i++) { - const property = new propertyType._elementType._objectConstructor(); - await property._read(communicator, buffer); - properties[i] = property; - } - this._properties.set(propertyCode, properties); - } - return; - default: - throw Errors.IgniteClientError.internalError(); - } - } -} - -module.exports = CacheConfiguration; -module.exports.QueryEntity = QueryEntity; -module.exports.QueryField = QueryField; -module.exports.QueryIndex = QueryIndex; -module.exports.CacheKeyConfiguration = CacheKeyConfiguration; diff --git a/modules/platforms/nodejs/lib/Cursor.js b/modules/platforms/nodejs/lib/Cursor.js deleted file mode 100644 index 39eea21e7a6eb..0000000000000 --- a/modules/platforms/nodejs/lib/Cursor.js +++ /dev/null @@ -1,307 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -'use strict'; - -const Errors = require('./Errors'); -const BinaryUtils = require('./internal/BinaryUtils'); -const BinaryObject = require('./BinaryObject'); - -/** - * Class representing a cursor to obtain results of SQL and Scan query operations. - * - * The class has no public constructor. An instance of this class is obtained - * via query() method of {@link CacheClient} objects. - * One instance of this class returns results of one SQL or Scan query operation. - * - * @hideconstructor - */ -class Cursor { - - /** - * Returns one element (cache entry - key-value pair) from the query results. - * - * Every new call returns the next cache entry from the query results. - * If the method returns null, no more entries are available. - * - * @async - * - * @return {Promise} - a cache entry (key-value pair). - */ - async getValue() { - if (!this._values || this._valueIndex >= this._values.length) { - await this._getValues(); - this._valueIndex = 0; - } - if (this._values && this._values.length > 0) { - const value = this._values[this._valueIndex]; - this._valueIndex++; - return value; - } - return null; - } - - /** - * Checks if more elements are available in the query results. - * - * @return {boolean} - true if more cache entries are available, false otherwise. - */ - hasMore() { - return this._hasNext || - this._values && this._valueIndex < this._values.length; - } - - /** - * Returns all elements (cache entries - key-value pairs) from the query results. - * - * May be used instead of getValue() method if the number of returned entries - * is relatively small and will not cause memory utilization issues. - * - * @async - * - * @return {Promise>} - all cache entries (key-value pairs) - * returned by SQL or Scan query. - */ - async getAll() { - let result = new Array(); - let values; - do { - values = await this._getValues(); - if (values) { - result = result.concat(values); - } - } while (this._hasNext); - return result; - } - - /** - * Closes the cursor. Obtaining elements from the results is not possible after this. - * - * This method should be called if no more elements are needed. - * It is not neccessary to call it if all elements have been already obtained. - * - * @async - */ - async close() { - // Close cursor only if the server has more pages: the server closes cursor automatically on last page - if (this._id && this._hasNext) { - await this._communicator.send( - BinaryUtils.OPERATION.RESOURCE_CLOSE, - async (payload) => { - await this._write(payload); - }); - } - } - - /** Private methods */ - - /** - * @ignore - */ - constructor(communicator, operation, buffer, keyType = null, valueType = null) { - this._communicator = communicator; - this._operation = operation; - this._buffer = buffer; - this._keyType = keyType; - this._valueType = valueType; - this._id = null; - this._hasNext = false; - this._values = null; - this._valueIndex = 0; - } - - /** - * @ignore - */ - async _getNext() { - this._hasNext = false; - this._values = null; - this._buffer = null; - await this._communicator.send( - this._operation, - async (payload) => { - await this._write(payload); - }, - async (payload) => { - this._buffer = payload; - }); - } - - /** - * @ignore - */ - async _getValues() { - if (!this._buffer && this._hasNext) { - await this._getNext(); - } - await this._read(this._buffer) - this._buffer = null; - return this._values; - } - - /** - * @ignore - */ - async _write(buffer) { - buffer.writeLong(this._id); - } - - /** - * @ignore - */ - _readId(buffer) { - this._id = buffer.readLong(); - } - - /** - * @ignore - */ - async _readRow(buffer) { - const CacheEntry = require('./CacheClient').CacheEntry; - return new CacheEntry( - await this._communicator.readObject(buffer, this._keyType), - await this._communicator.readObject(buffer, this._valueType)); - } - - /** - * @ignore - */ - async _read(buffer) { - const rowCount = buffer.readInteger(); - this._values = new Array(rowCount); - for (let i = 0; i < rowCount; i++) { - this._values[i] = await this._readRow(buffer); - } - this._hasNext = buffer.readBoolean(); - } -} - -/** - * Class representing a cursor to obtain results of SQL Fields query operation. - * - * The class has no public constructor. An instance of this class is obtained - * via query() method of {@link CacheClient} objects. - * One instance of this class returns results of one SQL Fields query operation. - * - * @hideconstructor - * @extends Cursor - */ -class SqlFieldsCursor extends Cursor { - - /** - * Returns one element (array with values of the fields) from the query results. - * - * Every new call returns the next element from the query results. - * If the method returns null, no more elements are available. - * - * @async - * - * @return {Promise>} - array with values of the fields requested by the query. - * - */ - async getValue() { - return await super.getValue(); - } - - /** - * Returns all elements (arrays with values of the fields) from the query results. - * - * May be used instead of getValue() method if the number of returned elements - * is relatively small and will not cause memory utilization issues. - * - * @async - * - * @return {Promise>>} - all results returned by SQL Fields query. - * Every element of the array is an array with values of the fields requested by the query. - * - */ - async getAll() { - return await super.getAll(); - } - - /** - * Returns names of the fields which were requested in the SQL Fields query. - * - * Empty array is returned if "include field names" flag was false in the query. - * - * @return {Array} - field names. - * The order of names corresponds to the order of field values returned in the results of the query. - */ - getFieldNames() { - return this._fieldNames; - } - - /** - * Specifies types of the fields returned by the SQL Fields query. - * - * By default, a type of every field is not specified that means during operations the Ignite client - * will try to make automatic mapping between JavaScript types and Ignite object types - - * according to the mapping table defined in the description of the {@link ObjectType} class. - * - * @param {...ObjectType.PRIMITIVE_TYPE | CompositeType} fieldTypes - types of the returned fields. - * The order of types must correspond the order of field values returned in the results of the query. - * A type of every field can be: - * - either a type code of primitive (simple) type - * - or an instance of class representing non-primitive (composite) type - * - or null (means the type is not specified) - * - * @return {SqlFieldsCursor} - the same instance of the SqlFieldsCursor. - */ - setFieldTypes(...fieldTypes) { - this._fieldTypes = fieldTypes; - return this; - } - - /** Private methods */ - - /** - * @ignore - */ - constructor(communicator, buffer) { - super(communicator, BinaryUtils.OPERATION.QUERY_SQL_FIELDS_CURSOR_GET_PAGE, buffer); - this._fieldNames = []; - } - - /** - * @ignore - */ - async _readFieldNames(buffer, includeFieldNames) { - this._id = buffer.readLong(); - this._fieldCount = buffer.readInteger(); - if (includeFieldNames) { - for (let i = 0; i < this._fieldCount; i++) { - this._fieldNames[i] = await this._communicator.readObject(buffer); - } - } - } - - /** - * @ignore - */ - async _readRow(buffer) { - let values = new Array(this._fieldCount); - let fieldType; - for (let i = 0; i < this._fieldCount; i++) { - fieldType = this._fieldTypes && i < this._fieldTypes.length ? this._fieldTypes[i] : null; - values[i] = await this._communicator.readObject(buffer, fieldType); - } - return values; - } -} - -module.exports.Cursor = Cursor; -module.exports.SqlFieldsCursor = SqlFieldsCursor; diff --git a/modules/platforms/nodejs/lib/EnumItem.js b/modules/platforms/nodejs/lib/EnumItem.js deleted file mode 100644 index 5e80da9dee2b5..0000000000000 --- a/modules/platforms/nodejs/lib/EnumItem.js +++ /dev/null @@ -1,212 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -'use strict'; - -const Util = require('util'); -const ArgumentChecker = require('./internal/ArgumentChecker'); -const Errors = require('./Errors'); - -/** - * Class representing an item of Ignite enum type. - * - * The item is defined by: - * - type Id (mandatory) - Id of the Ignite enum type. - * - ordinal (optional) - ordinal of the item in the Ignite enum type. - * - name (optional) - name of the item (field name in the Ignite enum type). - * - value (optional) - value of the item. - * Usually, at least one from the optional ordinal, name or value must be specified - * in order to use an instance of this class in Ignite operations. - * - * To distinguish one item from another, the Ignite client analyzes the optional fields in the following order: - * ordinal, name, value. - */ -class EnumItem { - - /** - * Public constructor. - * - * @param {number} typeId - Id of the Ignite enum type. - * - * @return {EnumItem} - new EnumItem instance - * - * @throws {IgniteClientError} if error. - */ - constructor(typeId) { - this.setTypeId(typeId); - this._ordinal = null; - this._name = null; - this._value = null; - } - - /** - * Returns Id of the Ignite enum type. - * - * @return {number} - Id of the enum type. - */ - getTypeId() { - return this._typeId; - } - - /** - * Updates Id of the Ignite enum type. - * - * @param {number} typeId - new Id of the Ignite enum type. - * - * @return {EnumItem} - the same instance of EnumItem - * - * @throws {IgniteClientError} if error. - */ - setTypeId(typeId) { - ArgumentChecker.isInteger(typeId, 'typeId'); - this._typeId = typeId; - return this; - } - - /** - * Returns ordinal of the item in the Ignite enum type - * or null if ordinal is not set. - * - * @return {number} - ordinal of the item in the Ignite enum type. - */ - getOrdinal() { - return this._ordinal; - } - - /** - * Sets or updates ordinal of the item in the Ignite enum type. - * - * @param {number} ordinal - ordinal of the item in the Ignite enum type. - * - * @return {EnumItem} - the same instance of EnumItem - * - * @throws {IgniteClientError} if error. - */ - setOrdinal(ordinal) { - ArgumentChecker.isInteger(ordinal, 'ordinal'); - this._ordinal = ordinal; - return this; - } - - /** - * Returns name of the item - * or null if name is not set. - * - * @return {string} - name of the item. - */ - getName() { - return this._name; - } - - /** - * Sets or updates name of the item. - * - * @param {string} name - name of the item. - * - * @return {EnumItem} - the same instance of EnumItem - * - * @throws {IgniteClientError} if error. - */ - setName(name) { - ArgumentChecker.notEmpty(name, 'name'); - this._name = name; - return this; - } - - /** - * Returns value of the item - * or null if value is not set. - * - * @return {number} - value of the item. - */ - getValue() { - return this._value; - } - - /** - * Sets or updates value of the item. - * - * @param {number} value - value of the item. - * - * @return {EnumItem} - the same instance of EnumItem - * - * @throws {IgniteClientError} if error. - */ - setValue(value) { - ArgumentChecker.isInteger(value, 'value'); - this._value = value; - return this; - } - - /** Private methods */ - - /** - * @ignore - */ - async _write(communicator, buffer) { - const type = await this._getType(communicator, this._typeId); - if (!type || !type._isEnum) { - throw Errors.IgniteClientError.enumSerializationError( - true, Util.format('enum type id "%d" is not registered', this._typeId)); - } - buffer.writeInteger(this._typeId); - if (this._ordinal !== null) { - buffer.writeInteger(this._ordinal); - return; - } - else if (this._name !== null || this._value !== null) { - if (type._enumValues) { - for (let i = 0; i < type._enumValues.length; i++) { - if (this._name === type._enumValues[i][0] || - this._value === type._enumValues[i][1]) { - buffer.writeInteger(i); - return; - } - } - } - } - throw Errors.IgniteClientError.illegalArgumentError( - 'Proper ordinal, name or value must be specified for EnumItem'); - } - - /** - * @ignore - */ - async _read(communicator, buffer) { - this._typeId = buffer.readInteger(); - this._ordinal = buffer.readInteger(); - const type = await this._getType(communicator, this._typeId); - if (!type || !type._isEnum) { - throw Errors.IgniteClientError.enumSerializationError( - false, Util.format('enum type id "%d" is not registered', this._typeId)); - } - else if (!type._enumValues || type._enumValues.length <= this._ordinal) { - throw Errors.IgniteClientError.enumSerializationError(false, 'type mismatch'); - } - this._name = type._enumValues[this._ordinal][0]; - this._value = type._enumValues[this._ordinal][1]; - } - - /** - * @ignore - */ - async _getType(communicator, typeId) { - return await communicator.typeStorage.getType(typeId); - } -} - -module.exports = EnumItem; diff --git a/modules/platforms/nodejs/lib/Errors.js b/modules/platforms/nodejs/lib/Errors.js deleted file mode 100644 index 89baf386ca0e8..0000000000000 --- a/modules/platforms/nodejs/lib/Errors.js +++ /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. - */ - -'use strict'; - -const Util = require('util'); - -/** - * Base Ignite client error class. - */ -class IgniteClientError extends Error { - constructor(message) { - super(message); - } - - /** - * Ignite client does not support one of the specified or received data types. - * @ignore - */ - static unsupportedTypeError(type) { - const BinaryUtils = require('./internal/BinaryUtils'); - return new IgniteClientError(Util.format('Type %s is not supported', BinaryUtils.getTypeName(type))); - } - - /** - * The real type of data is not equal to the specified one. - * @ignore - */ - static typeCastError(fromType, toType) { - const BinaryUtils = require('./internal/BinaryUtils'); - return new IgniteClientError(Util.format('Type "%s" can not be cast to %s', - BinaryUtils.getTypeName(fromType), BinaryUtils.getTypeName(toType))); - } - - /** - * The real value can not be cast to the specified type. - * @ignore - */ - static valueCastError(value, toType) { - const BinaryUtils = require('./internal/BinaryUtils'); - return new IgniteClientError(Util.format('Value "%s" can not be cast to %s', - value, BinaryUtils.getTypeName(toType))); - } - - /** - * An illegal or inappropriate argument has been passed to the API method. - * @ignore - */ - static illegalArgumentError(message) { - return new IgniteClientError(message); - } - - /** - * Ignite client internal error. - * @ignore - */ - static internalError(message = null) { - return new IgniteClientError(message || 'Internal library error'); - } - - /** - * Serialization/deserialization errors. - * @ignore - */ - static serializationError(serialize, message = null) { - let msg = serialize ? 'Complex object can not be serialized' : 'Complex object can not be deserialized'; - if (message) { - msg = msg + ': ' + message; - } - return new IgniteClientError(msg); - } - - /** - * EnumItem serialization/deserialization errors. - * @ignore - */ - static enumSerializationError(serialize, message = null) { - let msg = serialize ? 'Enum item can not be serialized' : 'Enum item can not be deserialized'; - if (message) { - msg = msg + ': ' + message; - } - return new IgniteClientError(msg); - } -} - -/** - * Ignite server returns error for the requested operation. - * @extends IgniteClientError - */ -class OperationError extends IgniteClientError { - constructor(message) { - super(message); - } -} - -/** - * Ignite client is not in an appropriate state for the requested operation. - * @extends IgniteClientError - */ -class IllegalStateError extends IgniteClientError { - constructor(message = null) { - super(message || 'Ignite client is not in an appropriate state for the requested operation'); - } -} - -/** - * The requested operation is not completed due to the connection lost. - * @extends IgniteClientError - */ -class LostConnectionError extends IgniteClientError { - constructor(message = null) { - super(message || 'Request is not completed due to the connection lost'); - } -} - -module.exports.IgniteClientError = IgniteClientError; -module.exports.OperationError = OperationError; -module.exports.IllegalStateError = IllegalStateError; -module.exports.LostConnectionError = LostConnectionError; diff --git a/modules/platforms/nodejs/lib/IgniteClient.js b/modules/platforms/nodejs/lib/IgniteClient.js deleted file mode 100644 index 1974352c42243..0000000000000 --- a/modules/platforms/nodejs/lib/IgniteClient.js +++ /dev/null @@ -1,290 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -'use strict'; - -const CacheClient = require('./CacheClient'); -const IgniteClientConfiguration = require('./IgniteClientConfiguration'); -const CacheConfiguration = require('./CacheConfiguration'); -const BinaryUtils = require('./internal/BinaryUtils'); -const BinaryCommunicator = require('./internal/BinaryCommunicator'); -const ArgumentChecker = require('./internal/ArgumentChecker'); -const Logger = require('./internal/Logger'); - -/** - * State of Ignite client. - * - * @typedef IgniteClient.STATE - * @enum - * @readonly - * @property DISCONNECTED The client is not connected to any Ignite node, - * operations with the Ignite server are not allowed. - * This is initial state after a client instance creation. - * If connect() method is called, the client moves to CONNECTING state. - * @property CONNECTING The client tries to connect to an Ignite node, - * operations with the Ignite server are not allowed. - * If disconnect() method is called, the client moves to DISCONNECTED state. - * If not possible to connect to any Ignite node, the client moves to DISCONNECTED state. - * If connection to an Ignite node is successful, the client moves to CONNECTED state. - * @property CONNECTED The client is connected to an Ignite node, - * all operations with the Ignite server are allowed. - * If connection with the Ignite node is lost, the client moves to CONNECTING state. - * If disconnect() method is called, the client moves to DISCONNECTED state. - */ -const STATE = Object.freeze({ - DISCONNECTED : 0, - CONNECTING : 1, - CONNECTED : 2 -}); - -/** - * Class representing Ignite client. - * - */ -class IgniteClient { - - /** - * Public constructor. - * - * @param {IgniteClient.onStateChanged} [onStateChanged] - - * callback called everytime when the client has moved to a new state {@link IgniteClient.STATE}. - * - * @return {IgniteClient} - new IgniteClient instance. - */ - constructor(onStateChanged = null) { - const ClientFailoverSocket = require('./internal/ClientFailoverSocket'); - this._socket = new ClientFailoverSocket(onStateChanged); - this._communicator = new BinaryCommunicator(this._socket); - } - - static get STATE() { - return STATE; - } - - /** - * onStateChanged callback. - * @callback IgniteClient.onStateChanged - * @param {IgniteClient.STATE} state - the new state of the client. - * @param {string} reason - the reason why the state has been changed. - */ - - /** - * Connects the client. - * - * Should be called from DISCONNECTED state only. - * Moves the client to CONNECTING state. - * - * @async - * - * @param {IgniteClientConfiguration} config - the client configuration. - * - * @throws {IllegalStateError} if the client is not in DISCONNECTED {@link IgniteClient.STATE}. - * @throws {IgniteClientError} if other error. - */ - async connect(config) { - ArgumentChecker.notEmpty(config, 'config'); - ArgumentChecker.hasType(config, 'config', false, IgniteClientConfiguration); - await this._socket.connect(config); - } - - /** - * Disconnects the client. - * - * Moves the client to DISCONNECTED state from any other state. - * Does nothing if the client already disconnected. - */ - disconnect() { - if (this._socket) { - this._socket.disconnect(); - } - } - - /** - * Creates new cache with the provided name and optional configuration. - * - * @async - * - * @param {string} name - cache name. - * @param {CacheConfiguration} [cacheConfig] - cache configuration. - * - * @return {Promise} - new cache client instance for the created cache. - * - * @throws {IllegalStateError} if the client is not in CONNECTED {@link IgniteClient.STATE}. - * @throws {OperationError} if cache with the provided name already exists. - * @throws {IgniteClientError} if other error. - */ - async createCache(name, cacheConfig = null) { - ArgumentChecker.notEmpty(name, 'name'); - ArgumentChecker.hasType(cacheConfig, 'cacheConfig', false, CacheConfiguration); - - await this._communicator.send( - cacheConfig ? - BinaryUtils.OPERATION.CACHE_CREATE_WITH_CONFIGURATION : - BinaryUtils.OPERATION.CACHE_CREATE_WITH_NAME, - async (payload) => { - await this._writeCacheNameOrConfig(payload, name, cacheConfig); - }); - return this._getCache(name, cacheConfig); - } - - /** - * Gets existing cache with the provided name - * or creates new one with the provided name and optional configuration. - * - * @async - * - * @param {string} name - cache name. - * @param {CacheConfiguration} [cacheConfig] - cache configuration (ignored if cache - * with the provided name already exists). - * - * @return {Promise} - new cache client instance for the existing or created cache. - * - * @throws {IllegalStateError} if the client is not in CONNECTED {@link IgniteClient.STATE}. - * @throws {IgniteClientError} if other error. - */ - async getOrCreateCache(name, cacheConfig = null) { - ArgumentChecker.notEmpty(name, 'name'); - ArgumentChecker.hasType(cacheConfig, 'cacheConfig', false, CacheConfiguration); - await this._communicator.send( - cacheConfig ? - BinaryUtils.OPERATION.CACHE_GET_OR_CREATE_WITH_CONFIGURATION : - BinaryUtils.OPERATION.CACHE_GET_OR_CREATE_WITH_NAME, - async (payload) => { - await this._writeCacheNameOrConfig(payload, name, cacheConfig); - }); - return this._getCache(name, cacheConfig); - } - - /** - * Gets cache client instance of cache with the provided name. - * The method does not check if the cache with the provided name exists. - * - * @param {string} name - cache name. - * - * @return {CacheClient} - new cache client instance. - * - * @throws {IgniteClientError} if error. - */ - getCache(name) { - ArgumentChecker.notEmpty(name, 'name'); - return this._getCache(name); - } - - /** - * Destroys cache with the provided name. - * - * @async - * - * @param {string} name - cache name. - * - * @throws {IllegalStateError} if the client is not in CONNECTED {@link IgniteClient.STATE}. - * @throws {OperationError} if cache with the provided name does not exist. - * @throws {IgniteClientError} if other error. - */ - async destroyCache(name) { - ArgumentChecker.notEmpty(name, 'name'); - await this._communicator.send( - BinaryUtils.OPERATION.CACHE_DESTROY, - async (payload) => { - payload.writeInteger(CacheClient._calculateId(name)); - }); - } - - /** - * Returns configuration of cache with the provided name. - * - * @async - * - * @param {string} name - cache name. - * - * @return {Promise} - cache configuration - * - * @throws {IllegalStateError} if the client is not in CONNECTED {@link IgniteClient.STATE}. - * @throws {OperationError} if cache with the provided name does not exist. - * @throws {IgniteClientError} if other error. - */ - async getCacheConfiguration(name) { - ArgumentChecker.notEmpty(name, 'name'); - let config; - await this._communicator.send( - BinaryUtils.OPERATION.CACHE_GET_CONFIGURATION, - async (payload) => { - payload.writeInteger(CacheClient._calculateId(name)); - payload.writeByte(0); - }, - async (payload) => { - config = new CacheConfiguration(); - await config._read(this._communicator, payload); - }); - return config; - } - - /** - * Gets existing cache names. - * - * @async - * - * @return {Promise>} - array with the existing cache names. - * The array is empty if no caches exist. - * - * @throws {IllegalStateError} if the client is not in CONNECTED {@link IgniteClient.STATE}. - * @throws {IgniteClientError} if other error. - */ - async cacheNames() { - let names; - await this._communicator.send( - BinaryUtils.OPERATION.CACHE_GET_NAMES, - null, - async (payload) => { - names = await this._communicator.readStringArray(payload); - }); - return names; - } - - /** - * Enables/disables the library debug output (including errors logging). - * Disabled by default. - * - * @param {boolean} value - true to enable, false to disable - */ - setDebug(value) { - Logger.debug = value; - } - - /** Private methods */ - - /** - * @ignore - */ - _getCache(name, cacheConfig = null) { - return new CacheClient(name, cacheConfig, this._communicator); - } - - /** - * @ignore - */ - async _writeCacheNameOrConfig(buffer, name, cacheConfig) { - if (cacheConfig) { - await cacheConfig._write(this._communicator, buffer, name); - } - else { - BinaryCommunicator.writeString(buffer, name); - } - } -} - -module.exports = IgniteClient; diff --git a/modules/platforms/nodejs/lib/IgniteClientConfiguration.js b/modules/platforms/nodejs/lib/IgniteClientConfiguration.js deleted file mode 100644 index 5dab92a4fcff1..0000000000000 --- a/modules/platforms/nodejs/lib/IgniteClientConfiguration.js +++ /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. - */ - -'use strict'; - -const FS = require('fs'); -const Util = require('util'); -const Errors = require('./Errors'); -const ArgumentChecker = require('./internal/ArgumentChecker'); - -/** - * Class representing Ignite client configuration. - * - * The configuration includes: - * - (mandatory) Ignite node endpoint(s) - * - (optional) user credentials for authentication - * - (optional) TLS enabling - * - (optional) connection options - */ -class IgniteClientConfiguration { - - /** - * Creates an instance of Ignite client configuration - * with the provided mandatory settings and default optional settings. - * - * By default, the client does not use authentication and secure connection. - * - * @param {...string} endpoints - Ignite node endpoint(s). - * The client randomly connects/reconnects to one of the specified node. - * - * @return {IgniteClientConfiguration} - new client configuration instance. - * - * @throws {IgniteClientError} if error. - */ - constructor(...endpoints) { - ArgumentChecker.notEmpty(endpoints, 'endpoints'); - this._endpoints = endpoints; - this._userName = null; - this._password = null; - this._useTLS = false; - this._options = null; - } - - - /** - * Sets username which will be used for authentication during the client's connection. - * - * If username is not set, the client does not use authentication during connection. - * - * @param {string} userName - username. If null, authentication is disabled. - * - * @return {IgniteClientConfiguration} - the same instance of the IgniteClientConfiguration. - * - * @throws {IgniteClientError} if error. - */ - setUserName(userName) { - this._userName = userName; - return this; - } - - /** - * Sets password which will be used for authentication during the client's connection. - * - * Password is ignored, if username is not set. - * If password is not set, it is considered empty. - * - * @param {string} password - password. If null, password is empty. - * - * @return {IgniteClientConfiguration} - the same instance of the IgniteClientConfiguration. - * - * @throws {IgniteClientError} if error. - */ - setPassword(password) { - this._password = password; - return this; - } - - /** - * Sets connection options. - * - * By default the client establishes a non-secure connection with default connection options defined by nodejs. - * - * @param {boolean} useTLS - if true, secure connection will be established; - * if false, non-secure connection will be established. - * @param {object} [connectionOptions=null] - connection options. - * - For non-secure connection options defined here {@link https://nodejs.org/api/net.html#net_net_createconnection_options_connectlistener} - * - For secure connection options defined here {@link https://nodejs.org/api/tls.html#tls_tls_connect_options_callback} - * - * @return {IgniteClientConfiguration} - the same instance of the IgniteClientConfiguration. - */ - setConnectionOptions(useTLS, connectionOptions = null) { - this._useTLS = useTLS; - this._options = connectionOptions; - return this; - } -} - -module.exports = IgniteClientConfiguration; diff --git a/modules/platforms/nodejs/lib/ObjectType.js b/modules/platforms/nodejs/lib/ObjectType.js deleted file mode 100644 index 00c4d56bc785b..0000000000000 --- a/modules/platforms/nodejs/lib/ObjectType.js +++ /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. - */ - -'use strict'; - -const Util = require('util'); -const Errors = require('./Errors'); -const ArgumentChecker = require('./internal/ArgumentChecker'); - -/** - * Supported Ignite type codes for primitive (simple) types. - * @typedef ObjectType.PRIMITIVE_TYPE - * @enum - * @readonly - * @property BYTE 1 - * @property SHORT 2 - * @property INTEGER 3 - * @property LONG 4 - * @property FLOAT 5 - * @property DOUBLE 6 - * @property CHAR 7 - * @property BOOLEAN 8 - * @property STRING 9 - * @property UUID 10 - * @property DATE 11 - * @property BYTE_ARRAY 12 - * @property SHORT_ARRAY 13 - * @property INTEGER_ARRAY 14 - * @property LONG_ARRAY 15 - * @property FLOAT_ARRAY 16 - * @property DOUBLE_ARRAY 17 - * @property CHAR_ARRAY 18 - * @property BOOLEAN_ARRAY 19 - * @property STRING_ARRAY 20 - * @property UUID_ARRAY 21 - * @property DATE_ARRAY 22 - * @property ENUM 28 - * @property ENUM_ARRAY 29 - * @property DECIMAL 30 - * @property DECIMAL_ARRAY 31 - * @property TIMESTAMP 33 - * @property TIMESTAMP_ARRAY 34 - * @property TIME 36 - * @property TIME_ARRAY 37 - */ -const PRIMITIVE_TYPE = Object.freeze({ - BYTE : 1, - SHORT : 2, - INTEGER : 3, - LONG : 4, - FLOAT : 5, - DOUBLE : 6, - CHAR : 7, - BOOLEAN : 8, - STRING : 9, - UUID : 10, - DATE : 11, - BYTE_ARRAY : 12, - SHORT_ARRAY : 13, - INTEGER_ARRAY : 14, - LONG_ARRAY : 15, - FLOAT_ARRAY : 16, - DOUBLE_ARRAY : 17, - CHAR_ARRAY : 18, - BOOLEAN_ARRAY : 19, - STRING_ARRAY : 20, - UUID_ARRAY : 21, - DATE_ARRAY : 22, - ENUM : 28, - ENUM_ARRAY : 29, - DECIMAL : 30, - DECIMAL_ARRAY : 31, - TIMESTAMP : 33, - TIMESTAMP_ARRAY : 34, - TIME : 36, - TIME_ARRAY : 37 -}); - -/** - * Supported Ignite type codes for non-primitive (composite) types. - * @typedef ObjectType.COMPOSITE_TYPE - * @enum - * @readonly - * @property OBJECT_ARRAY 23 - * @property COLLECTION 24 - * @property MAP 25 - * @property NULL 101 - * @property COMPLEX_OBJECT 103 - */ -const COMPOSITE_TYPE = Object.freeze({ - OBJECT_ARRAY : 23, - COLLECTION : 24, - MAP : 25, - NULL : 101, - COMPLEX_OBJECT : 103 -}); - -/** - * Base class representing a type of Ignite object. - * - * The class has no public constructor. Only subclasses may be instantiated. - * - * There are two groups of Ignite object types: - * - * - Primitive (simple) types. To fully describe such a type it is enough to specify - * Ignite type code {@link ObjectType.PRIMITIVE_TYPE} only. - * - * - Non-primitive (composite) types. To fully describe such a type - * Ignite type code {@link ObjectType.COMPOSITE_TYPE} with additional information should be specified. - * Eg. a kind of map or a kind of collection. - * - * This class helps the Ignite client to make a mapping between JavaScript types - * and types used by Ignite. - * - * In many methods the Ignite client does not require to directly specify a type of Ignite object. - * In this case the Ignite client tries to make automatic mapping between JavaScript types - * and Ignite object types according to the following mapping tables: - * - * ---------------------------------------------------------------------------- - * - * DEFAULT MAPPING FROM JavaScript type TO Ignite type code. - * - * This mapping is used when an application does not explicitly specify an Ignite type - * for a field and is writing data to that field. - * - *
- * | JavaScript type           | Ignite type code      |
- * | ------------------------- | ----------------------|
- * | number                    | DOUBLE                |
- * | boolean                   | BOOLEAN               |
- * | string                    | STRING                |
- * | Date                      | DATE                  |
- * | Timestamp*                | TIMESTAMP             |
- * | EnumItem*                 | ENUM                  |
- * | Decimal**                 | DECIMAL               |
- * | BinaryObject*             | COMPLEX_OBJECT        |
- * | Array of number           | DOUBLE_ARRAY          |
- * | Array of boolean          | BOOLEAN_ARRAY         |
- * | Array of string           | STRING_ARRAY          |
- * | Array of Date             | DATE_ARRAY            |
- * | Array of Timestamp*       | TIMESTAMP_ARRAY       |
- * | Array of EnumItem*        | ENUM_ARRAY            |
- * | Array of Decimal**        | DECIMAL_ARRAY         |
- * | Array of BinaryObject*    | OBJECT_ARRAY          |
- * | Array of any other Object | OBJECT_ARRAY          |
- * | Set                       | COLLECTION (HASH_SET) |
- * | Map                       | MAP (HASH_MAP)        |
- * | any other Object          | COMPLEX_OBJECT        |
- * 
- * - * Type of an array content is determined by the type of the first element of the array. - * Empty array has no default mapping. - * - * All other JavaScript types have no default mapping. - * - * ---------------------------------------------------------------------------- - * - * DEFAULT MAPPING FROM Ignite type code TO JavaScript type. - * - * This mapping is used when an application does not explicitly specify an Ignite type - * for a field and is reading data from that field. - * - *
- * | Ignite type code             | JavaScript type                       |
- * | ---------------------------- | --------------------------------------|
- * | BYTE                         | number                                |
- * | SHORT                        | number                                |
- * | INTEGER                      | number                                |
- * | LONG                         | number                                |
- * | FLOAT                        | number                                |
- * | DOUBLE                       | number                                |
- * | DECIMAL                      | Decimal**                             |
- * | BOOLEAN                      | boolean                               |
- * | STRING                       | string                                |
- * | CHAR                         | string (one character)                |
- * | UUID                         | Array of number (16 numbers)          |
- * | DATE                         | Date                                  |
- * | TIME                         | Date                                  |
- * | TIMESTAMP                    | Timestamp*                            |
- * | ENUM                         | EnumItem*                             |
- * | COMPLEX_OBJECT               | BinaryObject*                         |
- * | BYTE_ARRAY                   | Array of number                       |
- * | SHORT_ARRAY                  | Array of number                       |
- * | INTEGER_ARRAY                | Array of number                       |
- * | LONG_ARRAY                   | Array of number                       |
- * | FLOAT_ARRAY                  | Array of number                       |
- * | DOUBLE_ARRAY                 | Array of number                       |
- * | DECIMAL_ARRAY                | Array of Decimal**                    |
- * | BOOLEAN_ARRAY                | Array of boolean                      |
- * | STRING_ARRAY                 | Array of string                       |
- * | CHAR_ARRAY                   | Array of string (one character)       |
- * | UUID_ARRAY                   | Array of Array of number (16 numbers) |
- * | DATE_ARRAY                   | Array of Date                         |
- * | TIME_ARRAY                   | Array of Date                         |
- * | TIMESTAMP_ARRAY              | Array of Timestamp*                   |
- * | ENUM_ARRAY                   | Array of EnumItem*                    |
- * | OBJECT_ARRAY                 | Array                                 |
- * | COLLECTION (USER_COL)        | Array                                 |
- * | COLLECTION (ARR_LIST)        | Array                                 |
- * | COLLECTION (LINKED_LIST)     | Array                                 |
- * | COLLECTION (SINGLETON_LIST)  | Array                                 |
- * | COLLECTION (HASH_SET)        | Set                                   |
- * | COLLECTION (LINKED_HASH_SET) | Set                                   |
- * | COLLECTION (USER_SET)        | Set                                   |
- * | MAP (HASH_MAP)               | Map                                   |
- * | MAP (LINKED_HASH_MAP)        | Map                                   |
- * | NULL                         | null                                  |
- * 
- * - * ---------------------------------------------------------------------------- - * - * RETURNED JavaScript types WHEN READING DATA OF THE SPECIFIED Ignite type code. - * - * When an application explicitly specifies an Ignite type for a field - * and is reading data from that field - the following JavaScript types - * are returned for every concrete Ignite type code - - * - * SEE THE PREVIOUS TABLE with the following additional comments: - * - * - for COMPLEX_OBJECT the Ignite Client returns a JavaScript Object - * which is defined by the specified {@link ComplexObjectType}. - * - * - the returned Map for MAP is defined by the specified {@link MapObjectType}. - * - * - the returned Set or Array for COLLECTION is defined by the specified {@link CollectionObjectType}. - * - * - the returned Array for OBJECT_ARRAY is defined by the specified {@link ObjectArrayType}. - * - * - NULL cannot be specified as a type of a field but JavaScript null may be returned - * as a value of a field. - * - * ---------------------------------------------------------------------------- - * - * ALLOWED JavaScript types WHEN WRITING DATA OF THE SPECIFIED Ignite type code. - * - * When an application explicitly specifies an Ignite type for a field - * and is writing data to that field - the following JavaScript types - * are allowed for every concrete Ignite type code - - * - * SEE THE PREVIOUS TABLE with the following additional comments: - * - * - for COMPLEX_OBJECT the Ignite Client allows a JavaScript Object - * which is defined by the specified {@link ComplexObjectType}. - * - * - the allowed Map for MAP is defined by the specified {@link MapObjectType}. - * - * - the allowed Set or Array for COLLECTION is defined by the specified {@link CollectionObjectType}. - * - * - the allowed Array for OBJECT_ARRAY is defined by the specified {@link ObjectArrayType}. - * - * - NULL cannot be specified as a type of a field but JavaScript null is allowed - * as value of a field (but not as a key/value in a cache) or as a value of Array/Set/Map element - * for all Ignite types, except BYTE, SHORT, INTEGER, LONG, FLOAT, DOUBLE, CHAR, BOOLEAN. - * - * - for all *_ARRAY Ignite types an empty JavaScript Array is allowed. - * - * ---------------------------------------------------------------------------- - * - * COMMENTS TO ALL TABLES - * - * JavaScript type - is a JavaScript primitive or a JavaScript Object - * ({@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures}) - * - * (*) Timestamp, EnumItem and BinaryObject - are JavaScript Objects introduced by the Ignite client. - * - * (**) Decimal - is an external JavaScript Object exported into the Ignite client - * ({@link https://github.com/MikeMcl/decimal.js}) - * - * Ignite type code - is the type code of an Ignite primitive type ({@link ObjectType.PRIMITIVE_TYPE}) - * or an Ignite composite type ({@link ObjectType.COMPOSITE_TYPE}). - * - * ---------------------------------------------------------------------------- - * - * @hideconstructor - */ - -class ObjectType { - static get PRIMITIVE_TYPE() { - return PRIMITIVE_TYPE; - } - - static get COMPOSITE_TYPE() { - return COMPOSITE_TYPE; - } - - /** Private methods */ - - constructor(typeCode) { - this._typeCode = typeCode; - } -} - -/** - * Base class representing a non-primitive (composite) type of Ignite object. - * - * The class has no public constructor. Only subclasses may be instantiated. - * - * @hideconstructor - * @extends ObjectType - */ -class CompositeType extends ObjectType { -} - -/** - * Supported kinds of map. - * @typedef MapObjectType.MAP_SUBTYPE - * @enum - * @readonly - * @property HASH_MAP 1 - * @property LINKED_HASH_MAP 2 - */ -const MAP_SUBTYPE = Object.freeze({ - HASH_MAP : 1, - LINKED_HASH_MAP : 2 -}); - -/** - * Class representing a map type of Ignite object. - * - * It is described by COMPOSITE_TYPE.MAP {@link ObjectType.COMPOSITE_TYPE} - * and one of {@link MapObjectType.MAP_SUBTYPE}. - * - * @extends CompositeType - */ -class MapObjectType extends CompositeType { - static get MAP_SUBTYPE() { - return MAP_SUBTYPE; - } - - /** - * Public constructor. - * - * Optionally specifies a kind of map and types of keys and values in the map. - * - * If a kind of map is not specified, MAP_SUBTYPE.HASH_MAP is assumed. - * - * If key and/or value type is not specified then during operations the Ignite client - * will try to make automatic mapping between JavaScript types and Ignite object types - - * according to the mapping table defined in the description of the {@link ObjectType} class. - * - * @param {MapObjectType.MAP_SUBTYPE} [mapSubType=MAP_SUBTYPE.HASH_MAP] - map subtype, one of the - * {@link MapObjectType.MAP_SUBTYPE} constants. - * @param {ObjectType.PRIMITIVE_TYPE | CompositeType} [keyType=null] - type of the keys in the map: - * - either a type code of primitive (simple) type - * - or an instance of class representing non-primitive (composite) type - * - or null (or not specified) that means the type is not specified - * @param {ObjectType.PRIMITIVE_TYPE | CompositeType} [valueType=null] - type of the values in the map: - * - either a type code of primitive (simple) type - * - or an instance of class representing non-primitive (composite) type - * - or null (or not specified) that means the type is not specified - * - * @return {MapObjectType} - new MapObjectType instance - * - * @throws {IgniteClientError} if error. - */ - constructor(mapSubType = MapObjectType.MAP_SUBTYPE.HASH_MAP, keyType = null, valueType = null) { - super(COMPOSITE_TYPE.MAP); - const BinaryUtils = require('./internal/BinaryUtils'); - ArgumentChecker.hasValueFrom(mapSubType, 'mapSubType', false, MapObjectType.MAP_SUBTYPE); - this._subType = mapSubType; - BinaryUtils.checkObjectType(keyType, 'keyType'); - BinaryUtils.checkObjectType(valueType, 'valueType'); - this._keyType = keyType; - this._valueType = valueType; - } -} - -/** - * Supported kinds of collections. - * @typedef CollectionObjectType.COLLECTION_SUBTYPE - * @enum - * @readonly - * @property USER_SET -1 - * @property USER_COL 0 - * @property ARRAY_LIST 1 - * @property LINKED_LIST 2 - * @property HASH_SET 3 - * @property LINKED_HASH_SET 4 - * @property SINGLETON_LIST 5 - */ -const COLLECTION_SUBTYPE = Object.freeze({ - USER_SET : -1, - USER_COL : 0, - ARRAY_LIST : 1, - LINKED_LIST : 2, - HASH_SET : 3, - LINKED_HASH_SET : 4, - SINGLETON_LIST : 5 -}); - -/** - * Class representing a collection type of Ignite object. - * - * It is described by COMPOSITE_TYPE.COLLECTION {@link ObjectType.COMPOSITE_TYPE} - * and one of {@link CollectionObjectType.COLLECTION_SUBTYPE}. - * - * @extends CompositeType - */ -class CollectionObjectType extends CompositeType { - static get COLLECTION_SUBTYPE() { - return COLLECTION_SUBTYPE; - } - - /** - * Public constructor. - * - * Specifies a kind of collection - * and optionally specifies a type of elements in the collection. - * - * If the type of elements is not specified then during operations the Ignite client - * will try to make automatic mapping between JavaScript types and Ignite object types - - * according to the mapping table defined in the description of the {@link ObjectType} class. - * - * @param {CollectionObjectType.COLLECTION_SUBTYPE} collectionSubType - collection subtype, one of the - * {@link CollectionObjectType.COLLECTION_SUBTYPE} constants. - * @param {ObjectType.PRIMITIVE_TYPE | CompositeType} [elementType=null] - type of elements in the collection: - * - either a type code of primitive (simple) type - * - or an instance of class representing non-primitive (composite) type - * - or null (or not specified) that means the type is not specified - * - * @return {CollectionObjectType} - new CollectionObjectType instance - * - * @throws {IgniteClientError} if error. - */ - constructor(collectionSubType, elementType = null) { - super(COMPOSITE_TYPE.COLLECTION); - const BinaryUtils = require('./internal/BinaryUtils'); - ArgumentChecker.hasValueFrom( - collectionSubType, 'collectionSubType', false, CollectionObjectType.COLLECTION_SUBTYPE); - this._subType = collectionSubType; - BinaryUtils.checkObjectType(elementType, 'elementType'); - this._elementType = elementType; - } - - /** Private methods */ - - /** - * @ignore - */ - static _isSet(subType) { - return subType === CollectionObjectType.COLLECTION_SUBTYPE.USER_SET || - subType === CollectionObjectType.COLLECTION_SUBTYPE.HASH_SET || - subType === CollectionObjectType.COLLECTION_SUBTYPE.LINKED_HASH_SET; - } - - /** - * @ignore - */ - _isSet() { - return CollectionObjectType._isSet(this._subType); - } -} - -/** - * Class representing an array type of Ignite objects. - * - * It is described by COMPOSITE_TYPE.OBJECT_ARRAY {@link ObjectType.COMPOSITE_TYPE}. - * - * @extends CompositeType - */ -class ObjectArrayType extends CompositeType { - - /** - * Public constructor. - * - * Optionally specifies a type of elements in the array. - * - * If the type of elements is not specified then during operations the Ignite client - * will try to make automatic mapping between JavaScript types and Ignite object types - - * according to the mapping table defined in the description of the {@link ObjectType} class. - * - * @param {ObjectType.PRIMITIVE_TYPE | CompositeType} [elementType=null] - type of the array element: - * - either a type code of primitive (simple) type - * - or an instance of class representing non-primitive (composite) type - * - or null (or not specified) that means the type is not specified - * - * @return {ObjectArrayType} - new ObjectArrayType instance - * - * @throws {IgniteClientError} if error. - */ - constructor(elementType = null) { - super(COMPOSITE_TYPE.OBJECT_ARRAY); - const BinaryUtils = require('./internal/BinaryUtils'); - BinaryUtils.checkObjectType(elementType, 'elementType'); - this._elementType = elementType; - } -} - -/** - * Class representing a complex type of Ignite object. - * - * It is described by COMPOSITE_TYPE.COMPLEX_OBJECT {@link ObjectType.COMPOSITE_TYPE}, - * by a name of the complex type and by a JavaScript Object which is mapped to/from the Ignite complex type. - * - * @extends CompositeType - */ -class ComplexObjectType extends CompositeType { - - /** - * Public constructor. - * - * Specifies a JavaScript Object type which will be mapped to/from the complex type. - * This specification is done using an instance of the JavaScript Object. - * - * If an object of the complex type is going to be received (deserialized), - * the JavaScript Object must have a constructor without parameters or with optional parameters only. - * - * The JavaScript Object defines a set of fields of the complex type. - * - * By default, the fields have no types specified. It means during operations the Ignite client - * will try to make automatic mapping between JavaScript types and Ignite object types - - * according to the mapping table defined in the description of the {@link ObjectType} class. - * - * A type of any field may be specified later by setFieldType() method. - * - * By default, the name of the complex type is the name of the JavaScript Object. - * The name may be explicitely specified using optional typeName parameter in the constructor. - * - * @param {object} jsObject - instance of JavaScript Object which will be mapped to/from this complex type. - * @param {string} [typeName] - name of the complex type. - * - * @return {ComplexObjectType} - new ComplexObjectType instance - * - * @throws {IgniteClientError} if error. - */ - constructor(jsObject, typeName = null) { - super(COMPOSITE_TYPE.COMPLEX_OBJECT); - ArgumentChecker.notEmpty(jsObject, 'jsObject'); - this._template = jsObject; - this._objectConstructor = jsObject && jsObject.constructor ? - jsObject.constructor : Object; - if (!typeName) { - typeName = this._objectConstructor.name; - } - this._typeName = typeName; - this._fields = new Map(); - const BinaryUtils = require('./internal/BinaryUtils'); - for (let fieldName of BinaryUtils.getJsObjectFieldNames(this._template)) { - this._fields.set(fieldName, null); - } - } - - /** - * Specifies a type of the field in the complex type. - * - * If the type is not specified then during operations the Ignite client - * will try to make automatic mapping between JavaScript types and Ignite object types - - * according to the mapping table defined in the description of the {@link ObjectType} class. - * - * @param {string} fieldName - name of the field. - * @param {ObjectType.PRIMITIVE_TYPE | CompositeType} fieldType - type of the field: - * - either a type code of primitive (simple) type - * - or an instance of class representing non-primitive (composite) type - * - or null (means the type is not specified). - * - * @return {ComplexObjectType} - the same instance of the ComplexObjectType. - * - * @throws {IgniteClientError} if error. - */ - setFieldType(fieldName, fieldType) { - if (!this._fields.has(fieldName)) { - throw Errors.IgniteClientError.illegalArgumentError( - Util.format('Field "%s" is absent in the complex object type', fieldName)); - } - const BinaryUtils = require('./internal/BinaryUtils'); - BinaryUtils.checkObjectType(fieldType, 'fieldType'); - this._fields.set(fieldName, fieldType); - return this; - } - - /** Private methods */ - - /** - * @ignore - */ - _getFieldType(fieldName) { - return this._fields.get(fieldName); - } -} - -module.exports.ObjectType = ObjectType; -module.exports.CompositeType = CompositeType; -module.exports.MapObjectType = MapObjectType; -module.exports.CollectionObjectType = CollectionObjectType; -module.exports.ComplexObjectType = ComplexObjectType; -module.exports.ObjectArrayType = ObjectArrayType; diff --git a/modules/platforms/nodejs/lib/Query.js b/modules/platforms/nodejs/lib/Query.js deleted file mode 100644 index d3f6f873aa8d6..0000000000000 --- a/modules/platforms/nodejs/lib/Query.js +++ /dev/null @@ -1,508 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -'use strict'; - -const Cursor = require('./Cursor').Cursor; -const SqlFieldsCursor = require('./Cursor').SqlFieldsCursor; -const ArgumentChecker = require('./internal/ArgumentChecker'); -const BinaryCommunicator = require('./internal/BinaryCommunicator'); -const BinaryUtils = require('./internal/BinaryUtils'); - -const PAGE_SIZE_DEFAULT = 1024; - -/** - * Base class representing an Ignite SQL or Scan query. - * - * The class has no public constructor. Only subclasses may be instantiated. - * - * @hideconstructor - */ -class Query { - - /** - * Set local query flag. - * - * @param {boolean} local - local query flag: true or false. - * - * @return {Query} - the same instance of the Query. - */ - setLocal(local) { - this._local = local; - return this; - } - - /** - * Set {@link Cursor} page size. - * - * @param {number} pageSize - cursor page size. - * - * @return {Query} - the same instance of the Query. - */ - setPageSize(pageSize) { - this._pageSize = pageSize; - return this; - } - - /** Private methods */ - - /** - * @ignore - */ - constructor(operation) { - this._operation = operation; - this._local = false; - this._pageSize = PAGE_SIZE_DEFAULT; - } -} - -/** - * Class representing an SQL query which returns the whole cache entries (key-value pairs). - * @extends Query - */ -class SqlQuery extends Query { - - /** - * Public constructor. - * - * Requires name of a type (or SQL table) and SQL query string to be specified. - * Other SQL query settings have the following defaults: - *
-     *     SQL Query setting         :    Default value
-     *     Local query flag          :    false
-     *     Cursor page size          :    1024
-     *     Query arguments           :    not specified
-     *     Distributed joins flag    :    false
-     *     Replicated only flag      :    false
-     *     Timeout                   :    0 (disabled)
-     * 
- * Every setting may be changed using set methods. - * - * @param {string} type - name of a type or SQL table. - * @param {string} sql - SQL query string. - * - * @return {SqlQuery} - new SqlQuery instance. - */ - constructor(type, sql) { - super(BinaryUtils.OPERATION.QUERY_SQL); - this.setType(type); - this.setSql(sql); - this._args = null; - this._argTypes = null; - this._distributedJoins = false; - this._replicatedOnly = false; - this._timeout = 0; - } - - /** - * Set name of a type or SQL table. - * - * @param {string} type - name of a type or SQL table. - * - * @return {SqlQuery} - the same instance of the SqlQuery. - */ - setType(type) { - if (this instanceof SqlFieldsQuery) { - ArgumentChecker.invalidArgument(type, 'type', SqlFieldsQuery); - } - else { - ArgumentChecker.notNull(type, 'type'); - } - this._type = type; - return this; - } - - /** - * Set SQL query string. - * - * @param {string} sql - SQL query string. - * - * @return {SqlQuery} - the same instance of the SqlQuery. - */ - setSql(sql) { - ArgumentChecker.notNull(sql, 'sql'); - this._sql = sql; - return this; - } - - /** - * Set query arguments. - * - * Type of any argument may be specified using setArgTypes() method. - * If type of an argument is not specified then during operations the Ignite client - * will try to make automatic mapping between JavaScript types and Ignite object types - - * according to the mapping table defined in the description of the {@link ObjectType} class. - * - * @param {...*} args - Query arguments. - * - * @return {SqlQuery} - the same instance of the SqlQuery. - */ - setArgs(...args) { - this._args = args; - return this; - } - - /** - * Specifies types of query arguments. - * - * Query arguments itself are set using setArgs() method. - * By default, a type of every argument is not specified that means during operations the Ignite client - * will try to make automatic mapping between JavaScript types and Ignite object types - - * according to the mapping table defined in the description of the {@link ObjectType} class. - * - * @param {...ObjectType.PRIMITIVE_TYPE | CompositeType} argTypes - types of Query arguments. - * The order of types must follow the order of arguments in the setArgs() method. - * A type of every argument can be: - * - either a type code of primitive (simple) type - * - or an instance of class representing non-primitive (composite) type - * - or null (means the type is not specified) - * - * @return {SqlQuery} - the same instance of the SqlQuery. - */ - setArgTypes(...argTypes) { - this._argTypes = argTypes; - return this; - } - - /** - * Set distributed joins flag. - * - * @param {boolean} distributedJoins - distributed joins flag: true or false. - * - * @return {SqlQuery} - the same instance of the SqlQuery. - */ - setDistributedJoins(distributedJoins) { - this._distributedJoins = distributedJoins; - return this; - } - - /** - * Set replicated only flag. - * - * @param {boolean} replicatedOnly - replicated only flag: true or false. - * - * @return {SqlQuery} - the same instance of the SqlQuery. - */ - setReplicatedOnly(replicatedOnly) { - this._replicatedOnly = replicatedOnly; - return this; - } - - /** - * Set timeout. - * - * @param {number} timeout - timeout value in milliseconds. - * Must be non-negative. Zero value disables timeout. - * - * @return {SqlQuery} - the same instance of the SqlQuery. - */ - setTimeout(timeout) { - this._timeout = timeout; - return this; - } - - /** Private methods */ - - /** - * @ignore - */ - async _write(communicator, buffer) { - BinaryCommunicator.writeString(buffer, this._type); - BinaryCommunicator.writeString(buffer, this._sql); - await this._writeArgs(communicator, buffer); - buffer.writeBoolean(this._distributedJoins); - buffer.writeBoolean(this._local); - buffer.writeBoolean(this._replicatedOnly); - buffer.writeInteger(this._pageSize); - buffer.writeLong(this._timeout); - } - - /** - * @ignore - */ - async _writeArgs(communicator, buffer) { - const argsLength = this._args ? this._args.length : 0; - buffer.writeInteger(argsLength); - if (argsLength > 0) { - let argType; - for (let i = 0; i < argsLength; i++) { - argType = this._argTypes && i < this._argTypes.length ? this._argTypes[i] : null; - await communicator.writeObject(buffer, this._args[i], argType); - } - } - } - - /** - * @ignore - */ - async _getCursor(communicator, payload, keyType = null, valueType = null) { - const cursor = new Cursor(communicator, BinaryUtils.OPERATION.QUERY_SQL_CURSOR_GET_PAGE, payload, keyType, valueType); - cursor._readId(payload); - return cursor; - } -} - -/** - * Statement type of SQL Fields query. - * @typedef SqlFieldsQuery.STATEMENT_TYPE - * @enum - * @readonly - * @property ANY 0 - * @property SELECT 1 - * @property UPDATE 2 - */ -const STATEMENT_TYPE = Object.freeze({ - ANY : 0, - SELECT : 1, - UPDATE : 2 -}); - - -/** - * Class representing an SQL Fields query. - * @extends SqlQuery - */ -class SqlFieldsQuery extends SqlQuery { - - /** - * Public constructor. - * - * Requires SQL query string to be specified. - * Other SQL Fields query settings have the following defaults: - *
-     *     SQL Fields Query setting  :    Default value
-     *     Local query flag          :    false
-     *     Cursor page size          :    1024
-     *     Query arguments           :    not specified
-     *     Distributed joins flag    :    false
-     *     Replicated only flag      :    false
-     *     Timeout                   :    0 (disabled)
-     *     Schema for the query      :    not specified
-     *     Max rows                  :    -1
-     *     Statement type            :    STATEMENT_TYPE.ANY
-     *     Enforce join order flag   :    false
-     *     Collocated flag           :    false
-     *     Lazy query execution flag :    false
-     *     Include field names flag  :    false
-     * 
- * Every setting may be changed using set methods. - * - * @param {string} sql - SQL query string. - * - * @return {SqlFieldsQuery} - new SqlFieldsQuery instance. - */ - constructor(sql) { - super(null, sql); - this._operation = BinaryUtils.OPERATION.QUERY_SQL_FIELDS; - this._schema = null; - this._maxRows = -1; - this._statementType = SqlFieldsQuery.STATEMENT_TYPE.ANY; - this._enforceJoinOrder = false; - this._collocated = false; - this._lazy = false; - this._includeFieldNames = false; - } - - static get STATEMENT_TYPE() { - return STATEMENT_TYPE; - } - - /** - * Set schema for the query. - * - * @param {string} schema - schema for the query. - * - * @return {SqlFieldsQuery} - the same instance of the SqlFieldsQuery. - */ - setSchema(schema) { - this._schema = schema; - return this; - } - - /** - * Set max rows. - * - * @param {number} maxRows - max rows. - * - * @return {SqlFieldsQuery} - the same instance of the SqlFieldsQuery. - */ - setMaxRows(maxRows) { - this._maxRows = maxRows; - return this; - } - - /** - * Set statement type. - * - * @param {SqlFieldsQuery.STATEMENT_TYPE} type - statement type. - * - * @return {SqlFieldsQuery} - the same instance of the SqlFieldsQuery. - */ - setStatementType(type) { - this._statementType = type; - return this; - } - - /** - * Set enforce join order flag. - * - * @param {boolean} enforceJoinOrder - enforce join order flag: true or false. - * - * @return {SqlFieldsQuery} - the same instance of the SqlFieldsQuery. - */ - setEnforceJoinOrder(enforceJoinOrder) { - this._enforceJoinOrder = enforceJoinOrder; - return this; - } - - /** - * Set collocated flag. - * - * @param {boolean} collocated - collocated flag: true or false. - * - * @return {SqlFieldsQuery} - the same instance of the SqlFieldsQuery. - */ - setCollocated(collocated) { - this._collocated = collocated; - return this; - } - - /** - * Set lazy query execution flag. - * - * @param {boolean} lazy - lazy query execution flag: true or false. - * - * @return {SqlFieldsQuery} - the same instance of the SqlFieldsQuery. - */ - setLazy(lazy) { - this._lazy = lazy; - return this; - } - - /** - * Set include field names flag. - * - * @param {boolean} includeFieldNames - include field names flag: true or false. - * - * @return {SqlFieldsQuery} - the same instance of the SqlFieldsQuery. - */ - setIncludeFieldNames(includeFieldNames) { - this._includeFieldNames = includeFieldNames; - return this; - } - - /** Private methods */ - - /** - * @ignore - */ - async _write(communicator, buffer) { - BinaryCommunicator.writeString(buffer, this._schema); - buffer.writeInteger(this._pageSize); - buffer.writeInteger(this._maxRows); - BinaryCommunicator.writeString(buffer, this._sql); - await this._writeArgs(communicator, buffer) - buffer.writeByte(this._statementType); - buffer.writeBoolean(this._distributedJoins); - buffer.writeBoolean(this._local); - buffer.writeBoolean(this._replicatedOnly); - buffer.writeBoolean(this._enforceJoinOrder); - buffer.writeBoolean(this._collocated); - buffer.writeBoolean(this._lazy); - buffer.writeLong(this._timeout); - buffer.writeBoolean(this._includeFieldNames); - } - - /** - * @ignore - */ - async _getCursor(communicator, payload, keyType = null, valueType = null) { - const cursor = new SqlFieldsCursor(communicator, payload); - await cursor._readFieldNames(payload, this._includeFieldNames); - return cursor; - } -} - -/** - * Class representing a Scan query which returns the whole cache entries (key-value pairs). - * - * This version of the class does not support a possibility to specify a Filter object for the query. - * The query returns all entries from the entire cache or from the specified partition. - * @extends Query - */ -class ScanQuery extends Query { - - /** - * Public constructor. - * - * Scan query settings have the following defaults: - *
-     *     Scan Query setting        :    Default value
-     *     Local query flag          :    false
-     *     Cursor page size          :    1024
-     *     Partition number          :    -1 (entire cache)
-     *     Filter object             :    null (not supported)
-     * 
- * Every setting (except Filter object) may be changed using set methods. - * - * @return {ScanQuery} - new ScanQuery instance. - */ - constructor() { - super(BinaryUtils.OPERATION.QUERY_SCAN); - this._partitionNumber = -1; - } - - /** - * Sets a partition number over which this query should iterate. - * - * If negative, the query will iterate over all partitions in the cache. - * - * @param {number} partitionNumber - partition number over which this query should iterate. - * - * @return {ScanQuery} - the same instance of the ScanQuery. - */ - setPartitionNumber(partitionNumber) { - this._partitionNumber = partitionNumber; - return this; - } - - /** Private methods */ - - /** - * @ignore - */ - async _write(communicator, buffer) { - // filter - await communicator.writeObject(buffer, null); - buffer.writeInteger(this._pageSize); - buffer.writeInteger(this._partitionNumber); - buffer.writeBoolean(this._local); - } - - /** - * @ignore - */ - async _getCursor(communicator, payload, keyType = null, valueType = null) { - const cursor = new Cursor(communicator, BinaryUtils.OPERATION.QUERY_SCAN_CURSOR_GET_PAGE, payload, keyType, valueType); - cursor._readId(payload); - return cursor; - } -} - -module.exports.SqlQuery = SqlQuery; -module.exports.SqlFieldsQuery = SqlFieldsQuery; -module.exports.ScanQuery = ScanQuery; diff --git a/modules/platforms/nodejs/lib/Timestamp.js b/modules/platforms/nodejs/lib/Timestamp.js deleted file mode 100644 index 04d750ce12896..0000000000000 --- a/modules/platforms/nodejs/lib/Timestamp.js +++ /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. - */ - -'use strict'; - -const ArgumentChecker = require('./internal/ArgumentChecker'); - -/** - * Class representing an Ignite timestamp type. - * - * The timestamp extends the standard JavaScript {@link Date} Object and consists of: - * - time - the number of milliseconds since January 1, 1970, 00:00:00 UTC, - * methods of the JavaScript {@link Date} Object can be used to operate with the time. - * - nanoseconds - fraction of the last millisecond in the range from 0 to 999999 nanoseconds, - * this class specifies additional methods to operate with the nanoseconds. - * @extends Date - */ -class Timestamp extends Date { - - /** - * Public constructor. - * - * @param {number} time - integer value representing the number of milliseconds since January 1, 1970, 00:00:00 UTC. - * @param {number} nanos - integer value representing the nanoseconds of the last millisecond, - * should be in the range from 0 to 999999. - * - * @return {Timestamp} - new Timestamp instance - * - * @throws {IgniteClientError} if error. - */ - constructor(time, nanos) { - super(time); - this.setNanos(nanos); - } - - /** - * Returns the nanoseconds of the last millisecond from the timestamp. - * - * @return {number} - nanoseconds of the last millisecond. - */ - getNanos() { - return this._nanos; - } - - /** - * Updates the nanoseconds of the last millisecond in the timestamp. - * - * @param {number} nanos - new value for the nanoseconds of the last millisecond, - * should be in the range from 0 to 999999. - * - * @return {Timestamp} - the same instance of Timestamp - * - * @throws {IgniteClientError} if error. - */ - setNanos(nanos) { - ArgumentChecker.isInteger(nanos, 'nanos'); - this._nanos = nanos; - return this; - } -} - -module.exports = Timestamp; diff --git a/modules/platforms/nodejs/lib/internal/ArgumentChecker.js b/modules/platforms/nodejs/lib/internal/ArgumentChecker.js deleted file mode 100644 index 9e60ad6a3be1b..0000000000000 --- a/modules/platforms/nodejs/lib/internal/ArgumentChecker.js +++ /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. - */ - -'use strict'; - -const Util = require('util'); -const Errors = require('../Errors'); - -/** Helper class for the library methods arguments check. */ -class ArgumentChecker { - static notEmpty(arg, argName) { - if (!arg || arg instanceof Array && arg.length === 0) { - throw Errors.IgniteClientError.illegalArgumentError(Util.format('"%s" argument should not be empty', argName)); - } - } - - static notNull(arg, argName) { - if (arg === null || arg === undefined) { - throw Errors.IgniteClientError.illegalArgumentError(Util.format('"%s" argument should not be null', argName)); - } - } - - static hasType(arg, argName, isArray, ...types) { - if (arg === null) { - return; - } - if (isArray && arg instanceof Array) { - for (let a of arg) { - ArgumentChecker.hasType(a, argName, false, ...types); - } - } - else { - for (let type of types) { - if (arg instanceof type) { - return; - } - } - throw Errors.IgniteClientError.illegalArgumentError(Util.format('"%s" argument has incorrect type', argName)); - } - } - - static hasValueFrom(arg, argName, isArray, values) { - if (isArray && arg instanceof Array) { - for (let a of arg) { - ArgumentChecker.hasValueFrom(a, argName, false, values); - } - } - else { - if (!Object.values(values).includes(arg)) { - throw Errors.IgniteClientError.illegalArgumentError(Util.format('"%s" argument has incorrect value', argName)); - } - } - } - - static isInteger(arg, argName) { - if (arg === null || arg === undefined || !Number.isInteger(arg)) { - throw Errors.IgniteClientError.illegalArgumentError(Util.format('"%s" argument should be integer', argName)); - } - } - - static invalidArgument(arg, argName, type) { - if (arg !== null && arg !== undefined) { - throw Errors.IgniteClientError.illegalArgumentError( - Util.format('"%s" argument is invalid for %s', argName, type.constructor.name)); - } - } -} - -module.exports = ArgumentChecker; diff --git a/modules/platforms/nodejs/lib/internal/BinaryCommunicator.js b/modules/platforms/nodejs/lib/internal/BinaryCommunicator.js deleted file mode 100644 index 20ddcff6344ac..0000000000000 --- a/modules/platforms/nodejs/lib/internal/BinaryCommunicator.js +++ /dev/null @@ -1,409 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -'use strict'; - -const Decimal = require('decimal.js'); -const CollectionObjectType = require('../ObjectType').CollectionObjectType; -const ComplexObjectType = require('../ObjectType').ComplexObjectType; -const Errors = require('../Errors'); -const Timestamp = require('../Timestamp'); -const EnumItem = require('../EnumItem'); -const BinaryUtils = require('./BinaryUtils'); -const BinaryTypeStorage = require('./BinaryTypeStorage'); - -class BinaryCommunicator { - - constructor(socket) { - this._socket = socket; - this._typeStorage = new BinaryTypeStorage(this); - } - - static readString(buffer) { - const typeCode = buffer.readByte(); - BinaryUtils.checkTypesComatibility(BinaryUtils.TYPE_CODE.STRING, typeCode); - if (typeCode === BinaryUtils.TYPE_CODE.NULL) { - return null; - } - return buffer.readString(); - } - - static writeString(buffer, value) { - if (value === null) { - buffer.writeByte(BinaryUtils.TYPE_CODE.NULL); - } - else { - buffer.writeByte(BinaryUtils.TYPE_CODE.STRING); - buffer.writeString(value); - } - } - - async send(opCode, payloadWriter, payloadReader = null) { - await this._socket.send(opCode, payloadWriter, payloadReader); - } - - get typeStorage() { - return this._typeStorage; - } - - async readObject(buffer, expectedType = null) { - const typeCode = buffer.readByte(); - BinaryUtils.checkTypesComatibility(expectedType, typeCode); - return await this._readTypedObject(buffer, typeCode, expectedType); - } - - async readStringArray(buffer) { - return await this._readTypedObject(buffer, BinaryUtils.TYPE_CODE.STRING_ARRAY); - } - - async writeObject(buffer, object, objectType = null, writeObjectType = true) { - BinaryUtils.checkCompatibility(object, objectType); - if (object === null) { - buffer.writeByte(BinaryUtils.TYPE_CODE.NULL); - return; - } - - objectType = objectType ? objectType : BinaryUtils.calcObjectType(object); - const objectTypeCode = BinaryUtils.getTypeCode(objectType); - - if (writeObjectType) { - buffer.writeByte(objectTypeCode); - } - switch (objectTypeCode) { - case BinaryUtils.TYPE_CODE.BYTE: - case BinaryUtils.TYPE_CODE.SHORT: - case BinaryUtils.TYPE_CODE.INTEGER: - case BinaryUtils.TYPE_CODE.FLOAT: - case BinaryUtils.TYPE_CODE.DOUBLE: - buffer.writeNumber(object, objectTypeCode); - break; - case BinaryUtils.TYPE_CODE.LONG: - buffer.writeLong(object); - break; - case BinaryUtils.TYPE_CODE.CHAR: - buffer.writeChar(object); - break; - case BinaryUtils.TYPE_CODE.BOOLEAN: - buffer.writeBoolean(object); - break; - case BinaryUtils.TYPE_CODE.STRING: - buffer.writeString(object); - break; - case BinaryUtils.TYPE_CODE.UUID: - this._writeUUID(buffer, object); - break; - case BinaryUtils.TYPE_CODE.DATE: - buffer.writeDate(object); - break; - case BinaryUtils.TYPE_CODE.ENUM: - await this._writeEnum(buffer, object); - break; - case BinaryUtils.TYPE_CODE.DECIMAL: - this._writeDecimal(buffer, object); - break; - case BinaryUtils.TYPE_CODE.TIMESTAMP: - this._writeTimestamp(buffer, object); - break; - case BinaryUtils.TYPE_CODE.TIME: - this._writeTime(buffer, object); - break; - case BinaryUtils.TYPE_CODE.BYTE_ARRAY: - case BinaryUtils.TYPE_CODE.SHORT_ARRAY: - case BinaryUtils.TYPE_CODE.INTEGER_ARRAY: - case BinaryUtils.TYPE_CODE.LONG_ARRAY: - case BinaryUtils.TYPE_CODE.FLOAT_ARRAY: - case BinaryUtils.TYPE_CODE.DOUBLE_ARRAY: - case BinaryUtils.TYPE_CODE.CHAR_ARRAY: - case BinaryUtils.TYPE_CODE.BOOLEAN_ARRAY: - case BinaryUtils.TYPE_CODE.STRING_ARRAY: - case BinaryUtils.TYPE_CODE.UUID_ARRAY: - case BinaryUtils.TYPE_CODE.DATE_ARRAY: - case BinaryUtils.TYPE_CODE.OBJECT_ARRAY: - case BinaryUtils.TYPE_CODE.ENUM_ARRAY: - case BinaryUtils.TYPE_CODE.DECIMAL_ARRAY: - case BinaryUtils.TYPE_CODE.TIMESTAMP_ARRAY: - case BinaryUtils.TYPE_CODE.TIME_ARRAY: - await this._writeArray(buffer, object, objectType, objectTypeCode); - break; - case BinaryUtils.TYPE_CODE.COLLECTION: - await this._writeCollection(buffer, object, objectType); - break; - case BinaryUtils.TYPE_CODE.MAP: - await this._writeMap(buffer, object, objectType); - break; - case BinaryUtils.TYPE_CODE.BINARY_OBJECT: - await this._writeBinaryObject(buffer, object, objectType); - break; - case BinaryUtils.TYPE_CODE.COMPLEX_OBJECT: - await this._writeComplexObject(buffer, object, objectType); - break; - default: - throw Errors.IgniteClientError.unsupportedTypeError(objectType); - } - } - - async _readTypedObject(buffer, objectTypeCode, expectedType = null) { - switch (objectTypeCode) { - case BinaryUtils.TYPE_CODE.BYTE: - case BinaryUtils.TYPE_CODE.SHORT: - case BinaryUtils.TYPE_CODE.INTEGER: - case BinaryUtils.TYPE_CODE.FLOAT: - case BinaryUtils.TYPE_CODE.DOUBLE: - return buffer.readNumber(objectTypeCode); - case BinaryUtils.TYPE_CODE.LONG: - return buffer.readLong().toNumber(); - case BinaryUtils.TYPE_CODE.CHAR: - return buffer.readChar(); - case BinaryUtils.TYPE_CODE.BOOLEAN: - return buffer.readBoolean(); - case BinaryUtils.TYPE_CODE.STRING: - return buffer.readString(); - case BinaryUtils.TYPE_CODE.UUID: - return this._readUUID(buffer); - case BinaryUtils.TYPE_CODE.DATE: - return buffer.readDate(); - case BinaryUtils.TYPE_CODE.ENUM: - case BinaryUtils.TYPE_CODE.BINARY_ENUM: - return await this._readEnum(buffer); - case BinaryUtils.TYPE_CODE.DECIMAL: - return this._readDecimal(buffer); - case BinaryUtils.TYPE_CODE.TIMESTAMP: - return this._readTimestamp(buffer); - case BinaryUtils.TYPE_CODE.TIME: - return buffer.readDate(); - case BinaryUtils.TYPE_CODE.BYTE_ARRAY: - case BinaryUtils.TYPE_CODE.SHORT_ARRAY: - case BinaryUtils.TYPE_CODE.INTEGER_ARRAY: - case BinaryUtils.TYPE_CODE.LONG_ARRAY: - case BinaryUtils.TYPE_CODE.FLOAT_ARRAY: - case BinaryUtils.TYPE_CODE.DOUBLE_ARRAY: - case BinaryUtils.TYPE_CODE.CHAR_ARRAY: - case BinaryUtils.TYPE_CODE.BOOLEAN_ARRAY: - case BinaryUtils.TYPE_CODE.STRING_ARRAY: - case BinaryUtils.TYPE_CODE.UUID_ARRAY: - case BinaryUtils.TYPE_CODE.DATE_ARRAY: - case BinaryUtils.TYPE_CODE.OBJECT_ARRAY: - case BinaryUtils.TYPE_CODE.ENUM_ARRAY: - case BinaryUtils.TYPE_CODE.DECIMAL_ARRAY: - case BinaryUtils.TYPE_CODE.TIMESTAMP_ARRAY: - case BinaryUtils.TYPE_CODE.TIME_ARRAY: - return await this._readArray(buffer, objectTypeCode, expectedType); - case BinaryUtils.TYPE_CODE.COLLECTION: - return await this._readCollection(buffer, expectedType); - case BinaryUtils.TYPE_CODE.MAP: - return await this._readMap(buffer, expectedType); - case BinaryUtils.TYPE_CODE.BINARY_OBJECT: - return await this._readBinaryObject(buffer, expectedType); - case BinaryUtils.TYPE_CODE.NULL: - return null; - case BinaryUtils.TYPE_CODE.COMPLEX_OBJECT: - return await this._readComplexObject(buffer, expectedType); - default: - throw Errors.IgniteClientError.unsupportedTypeError(objectTypeCode); - } - } - - _readUUID(buffer) { - return [...buffer.readBuffer(BinaryUtils.getSize(BinaryUtils.TYPE_CODE.UUID)).swap64()]; - } - - async _readEnum(buffer) { - const enumItem = new EnumItem(0); - await enumItem._read(this, buffer); - return enumItem; - } - - _readDecimal(buffer) { - const scale = buffer.readInteger(); - const dataLength = buffer.readInteger(); - const data = buffer.readBuffer(dataLength); - const isNegative = (data[0] & 0x80) !== 0; - if (isNegative) { - data[0] &= 0x7F; - } - let result = new Decimal('0x' + data.toString('hex')); - if (isNegative) { - result = result.negated(); - } - return result.mul(Decimal.pow(10, -scale)); - } - - _readTimestamp(buffer) { - return new Timestamp(buffer.readLong().toNumber(), buffer.readInteger()); - } - - async _readArray(buffer, arrayTypeCode, arrayType) { - if (arrayTypeCode === BinaryUtils.TYPE_CODE.OBJECT_ARRAY) { - buffer.readInteger(); - } - const length = buffer.readInteger(); - const elementType = BinaryUtils.getArrayElementType(arrayType ? arrayType : arrayTypeCode); - const keepElementType = elementType === null ? true : BinaryUtils.keepArrayElementType(arrayTypeCode); - const result = new Array(length); - for (let i = 0; i < length; i++) { - result[i] = keepElementType ? - await this.readObject(buffer, elementType) : - await this._readTypedObject(buffer, elementType); - } - return result; - } - - async _readMap(buffer, expectedMapType) { - const result = new Map(); - const size = buffer.readInteger(); - const subType = buffer.readByte(); - let key, value; - for (let i = 0; i < size; i++) { - key = await this.readObject(buffer, expectedMapType ? expectedMapType._keyType : null); - value = await this.readObject(buffer, expectedMapType ? expectedMapType._valueType : null); - result.set(key, value); - } - return result; - } - - async _readCollection(buffer, expectedColType) { - const size = buffer.readInteger(); - const subType = buffer.readByte(); - const isSet = CollectionObjectType._isSet(subType); - const result = isSet ? new Set() : new Array(size); - let element; - for (let i = 0; i < size; i++) { - element = await this.readObject(buffer, expectedColType ? expectedColType._elementType : null); - if (isSet) { - result.add(element); - } - else { - result[i] = element; - } - } - return result; - } - - async _readBinaryObject(buffer, expectedType) { - const size = buffer.readInteger(); - const startPos = buffer.position; - buffer.position = startPos + size; - const offset = buffer.readInteger(); - const endPos = buffer.position; - buffer.position = startPos + offset; - const result = await this.readObject(buffer, expectedType); - buffer.position = endPos; - return result; - } - - async _readComplexObject(buffer, expectedType) { - buffer.position = buffer.position - 1; - const BinaryObject = require('../BinaryObject'); - const binaryObject = await BinaryObject._fromBuffer(this, buffer); - return expectedType ? - await binaryObject.toObject(expectedType) : binaryObject; - } - - _writeUUID(buffer, value) { - buffer.writeBuffer(Buffer.from(value).swap64()); - } - - async _writeEnum(buffer, enumValue) { - await enumValue._write(this, buffer); - } - - _writeDecimal(buffer, decimal) { - let strValue = decimal.toExponential(); - let expIndex = strValue.indexOf('e'); - if (expIndex < 0) { - expIndex = strValue.indexOf('E'); - } - let scale = 0; - if (expIndex >= 0) { - scale = parseInt(strValue.substring(expIndex + 1)); - strValue = strValue.substring(0, expIndex); - } - const isNegative = strValue.startsWith('-'); - if (isNegative) { - strValue = strValue.substring(1); - } - const dotIndex = strValue.indexOf('.'); - if (dotIndex >= 0) { - scale -= strValue.length - dotIndex - 1; - strValue = strValue.substring(0, dotIndex) + strValue.substring(dotIndex + 1); - } - scale = -scale; - let hexValue = new Decimal(strValue).toHexadecimal().substring(2); - hexValue = ((hexValue.length % 2 !== 0) ? '000' : '00') + hexValue; - const valueBuffer = Buffer.from(hexValue, 'hex'); - if (isNegative) { - valueBuffer[0] |= 0x80; - } - buffer.writeInteger(scale); - buffer.writeInteger(valueBuffer.length); - buffer.writeBuffer(valueBuffer); - } - - _writeTimestamp(buffer, timestamp) { - buffer.writeDate(timestamp); - buffer.writeInteger(timestamp.getNanos()); - } - - _writeTime(buffer, time) { - const midnight = new Date(time); - midnight.setHours(0, 0, 0, 0); - buffer.writeLong(time.getTime() - midnight.getTime()); - } - - async _writeArray(buffer, array, arrayType, arrayTypeCode) { - const BinaryType = require('./BinaryType'); - const elementType = BinaryUtils.getArrayElementType(arrayType); - const keepElementType = BinaryUtils.keepArrayElementType(arrayTypeCode); - if (arrayTypeCode === BinaryUtils.TYPE_CODE.OBJECT_ARRAY) { - buffer.writeInteger(elementType instanceof ComplexObjectType ? - BinaryType._calculateId(elementType._typeName) : -1); - } - buffer.writeInteger(array.length); - for (let elem of array) { - await this.writeObject(buffer, elem, elementType, keepElementType); - } - } - - async _writeCollection(buffer, collection, collectionType) { - buffer.writeInteger(collection instanceof Set ? collection.size : collection.length); - buffer.writeByte(collectionType._subType); - for (let element of collection) { - await this.writeObject(buffer, element, collectionType._elementType); - } - } - - async _writeMap(buffer, map, mapType) { - buffer.writeInteger(map.size); - buffer.writeByte(mapType._subType); - for (let [key, value] of map.entries()) { - await this.writeObject(buffer, key, mapType._keyType); - await this.writeObject(buffer, value, mapType._valueType); - } - } - - async _writeBinaryObject(buffer, binaryObject) { - buffer.position = buffer.position - 1; - await binaryObject._write(this, buffer); - } - - async _writeComplexObject(buffer, object, objectType) { - const BinaryObject = require('../BinaryObject'); - await this._writeBinaryObject(buffer, await BinaryObject.fromObject(object, objectType)); - } -} - -module.exports = BinaryCommunicator; diff --git a/modules/platforms/nodejs/lib/internal/BinaryType.js b/modules/platforms/nodejs/lib/internal/BinaryType.js deleted file mode 100644 index 4a364268758e2..0000000000000 --- a/modules/platforms/nodejs/lib/internal/BinaryType.js +++ /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. - */ - -'use strict'; - -const Util = require('util'); -const Long = require('long'); -const ComplexObjectType = require('../ObjectType').ComplexObjectType; -const BinaryTypeStorage = require('./BinaryTypeStorage'); -const BinaryUtils = require('./BinaryUtils'); -const BinaryCommunicator = require('./BinaryCommunicator'); -const Errors = require('../Errors'); - -class BinaryType { - constructor(name) { - this._name = name; - this._id = BinaryType._calculateId(name); - this._fields = new Map(); - this._schemas = new Map(); - this._isEnum = false; - this._enumValues = null; - } - - get id() { - return this._id; - } - - get name() { - return this._name; - } - - get fields() { - return [...this._fields.values()]; - } - - getField(fieldId) { - return this._fields.get(fieldId); - } - - hasField(fieldId) { - return this._fields.has(fieldId); - } - - removeField(fieldId) { - return this._fields.delete(fieldId); - } - - setField(field) { - this._fields.set(field.id, field); - } - - hasSchema(schemaId) { - return this._schemas.has(schemaId); - } - - addSchema(schema) { - if (!this.hasSchema(schema.id)) { - this._schemas.set(schema.id, schema); - } - } - - getSchema(schemaId) { - return this._schemas.get(schemaId); - } - - merge(binaryType, binarySchema) { - let fieldId; - for (let field of binaryType.fields) { - fieldId = field.id; - if (this.hasField(fieldId)) { - if (this.getField(fieldId).typeCode !== field.typeCode) { - throw Errors.IgniteClientError.serializationError( - true, Util.format('type conflict for field "%s" of complex object type "%s"'), - field.name, this._name); - } - } - else { - this.setField(field); - } - } - this.addSchema(binarySchema); - } - - clone() { - const result = new BinaryType(); - result._name = this._name; - result._id = this._id; - result._fields = new Map(this._fields.entries()); - result._schemas = new Map(this._schemas.entries()); - result._isEnum = this._isEnum; - return result; - } - - isValid() { - for (let field of this._fields.values()) { - if (!field.isValid()) { - return false; - } - } - return this._name !== null; - } - - static _calculateId(name) { - return BinaryUtils.hashCodeLowerCase(name); - } - - async _write(buffer) { - // type id - buffer.writeInteger(this._id); - // type name - BinaryCommunicator.writeString(buffer, this._name); - // affinity key field name - BinaryCommunicator.writeString(buffer, null); - // fields count - buffer.writeInteger(this._fields.size); - // fields - for (let field of this._fields.values()) { - await field._write(buffer); - } - await this._writeEnum(buffer); - // schemas count - buffer.writeInteger(this._schemas.size); - for (let schema of this._schemas.values()) { - await schema._write(buffer); - } - } - - async _writeEnum(buffer) { - buffer.writeBoolean(this._isEnum); - if (this._isEnum) { - const length = this._enumValues ? this._enumValues.length : 0; - buffer.writeInteger(length); - if (length > 0) { - for (let [key, value] of this._enumValues) { - BinaryCommunicator.writeString(buffer, key); - buffer.writeInteger(value); - } - } - } - } - - async _read(buffer) { - // type id - this._id = buffer.readInteger(); - // type name - this._name = BinaryCommunicator.readString(buffer); - // affinity key field name - BinaryCommunicator.readString(buffer); - // fields count - const fieldsCount = buffer.readInteger(); - // fields - let field; - for (let i = 0; i < fieldsCount; i++) { - field = new BinaryField(null, null); - await field._read(buffer); - this.setField(field); - } - await this._readEnum(buffer); - // schemas count - const schemasCount = buffer.readInteger(); - // schemas - let schema; - for (let i = 0; i < schemasCount; i++) { - schema = new BinarySchema(); - await schema._read(buffer); - this.addSchema(schema); - } - } - - async _readEnum(buffer) { - this._isEnum = buffer.readBoolean(); - if (this._isEnum) { - const valuesCount = buffer.readInteger(); - this._enumValues = new Array(valuesCount); - for (let i = 0; i < valuesCount; i++) { - this._enumValues[i] = [BinaryCommunicator.readString(buffer), buffer.readInteger()]; - } - } - } -} - -/** FNV1 hash offset basis. */ -const FNV1_OFFSET_BASIS = 0x811C9DC5; -/** FNV1 hash prime. */ -const FNV1_PRIME = 0x01000193; - -class BinarySchema { - constructor() { - this._id = BinarySchema._schemaInitialId(); - this._fieldIds = new Set(); - this._isValid = true; - } - - get id() { - return this._id; - } - - get fieldIds() { - return [...this._fieldIds]; - } - - finalize() { - if (!this._isValid) { - this._id = BinarySchema._schemaInitialId(); - for (let fieldId of this._fieldIds) { - this._id = BinarySchema._updateSchemaId(this._id, fieldId); - } - this._isValid = true; - } - } - - clone() { - const result = new BinarySchema(); - result._id = this._id; - result._fieldIds = new Set(this._fieldIds); - result._isValid = this._isValid; - return result; - } - - addField(fieldId) { - if (!this.hasField(fieldId)) { - this._fieldIds.add(fieldId); - if (this._isValid) { - this._id = BinarySchema._updateSchemaId(this._id, fieldId); - } - } - } - - removeField(fieldId) { - if (this._fieldIds.delete(fieldId)) { - this._isValid = false; - } - } - - hasField(fieldId) { - return this._fieldIds.has(fieldId); - } - - static _schemaInitialId() { - return FNV1_OFFSET_BASIS | 0; - } - - static _updateSchemaId(schemaId, fieldId) { - schemaId = BinarySchema._updateSchemaIdPart(schemaId, fieldId & 0xFF); - schemaId = BinarySchema._updateSchemaIdPart(schemaId, (fieldId >> 8) & 0xFF); - schemaId = BinarySchema._updateSchemaIdPart(schemaId, (fieldId >> 16) & 0xFF); - schemaId = BinarySchema._updateSchemaIdPart(schemaId, (fieldId >> 24) & 0xFF); - return schemaId; - } - - static _updateSchemaIdPart(schemaId, fieldIdPart) { - schemaId = schemaId ^ fieldIdPart; - schemaId = Long.fromValue(schemaId).multiply(FNV1_PRIME).getLowBits(); - return schemaId; - } - - async _write(buffer) { - this.finalize(); - // schema id - buffer.writeInteger(this._id); - // fields count - buffer.writeInteger(this._fieldIds.size); - // field ids - for (let fieldId of this._fieldIds) { - buffer.writeInteger(fieldId); - } - } - - async _read(buffer) { - // schema id - this._id = buffer.readInteger(); - // fields count - const fieldsCount = buffer.readInteger(); - // field ids - for (let i = 0; i < fieldsCount; i++) { - this._fieldIds.add(buffer.readInteger()); - } - } -} - -class BinaryField { - constructor(name, typeCode) { - this._name = name; - this._id = BinaryField._calculateId(name); - this._typeCode = typeCode; - } - - get id() { - return this._id; - } - - get name() { - return this._name; - } - - get typeCode() { - return this._typeCode; - } - - isValid() { - return this._name !== null; - } - - static _calculateId(name) { - return BinaryUtils.hashCodeLowerCase(name); - } - - async _write(buffer) { - // field name - BinaryCommunicator.writeString(buffer, this._name); - // type code - buffer.writeInteger(this._typeCode); - // field id - buffer.writeInteger(this._id); - } - - async _read(buffer) { - // field name - this._name = BinaryCommunicator.readString(buffer); - // type code - this._typeCode = buffer.readInteger(); - // field id - this._id = buffer.readInteger(); - } -} - -class BinaryTypeBuilder { - - static fromTypeName(typeName) { - let result = new BinaryTypeBuilder(); - result._init(typeName); - return result; - } - - static async fromTypeId(communicator, typeId, schemaId) { - let result = new BinaryTypeBuilder(); - let type = await communicator.typeStorage.getType(typeId, schemaId); - if (type) { - result._type = type; - if (schemaId !== null) { - result._schema = type.getSchema(schemaId); - if (!result._schema) { - throw Errors.IgniteClientError.serializationError( - false, Util.format('schema id "%d" specified for complex object of type "%s" not found', - schemaId, type.name)); - } - result._fromStorage = true; - } - else { - result._schema = new BinarySchema(); - } - return result; - } - result._init(null); - result._type._id = typeId; - return result; - } - - static fromObject(jsObject, complexObjectType = null) { - if (complexObjectType) { - return BinaryTypeBuilder.fromComplexObjectType(complexObjectType, jsObject); - } - else { - const result = new BinaryTypeBuilder(); - result._fromComplexObjectType(new ComplexObjectType(jsObject), jsObject); - return result; - } - } - - static fromComplexObjectType(complexObjectType, jsObject) { - let result = new BinaryTypeBuilder(); - const typeInfo = BinaryTypeStorage.getByComplexObjectType(complexObjectType); - if (typeInfo) { - result._type = typeInfo[0]; - result._schema = typeInfo[1]; - result._fromStorage = true; - } - else { - result._fromComplexObjectType(complexObjectType, jsObject); - BinaryTypeStorage.setByComplexObjectType(complexObjectType, result._type, result._schema); - } - return result; - } - - getTypeId() { - return this._type.id; - } - - getTypeName() { - return this._type.name; - } - - getSchemaId() { - return this._schema.id; - } - - getFields() { - return this._type.fields; - } - - getField(fieldId) { - return this._type._fields.get(fieldId); - } - - setField(fieldName, fieldTypeCode = null) { - const fieldId = BinaryField._calculateId(fieldName); - if (!this._type.hasField(fieldId) || !this._schema.hasField(fieldId) || - this._type.getField(fieldId).typeCode !== fieldTypeCode) { - this._beforeModify(); - this._type.setField(new BinaryField(fieldName, fieldTypeCode)); - this._schema.addField(fieldId); - } - } - - removeField(fieldName) { - const fieldId = BinaryField._calculateId(fieldName); - if (this._type.hasField(fieldId)) { - this._beforeModify(); - this._type.removeField(fieldId); - this._schema.removeField(fieldId); - } - } - - async finalize(communicator) { - this._schema.finalize(); - await communicator.typeStorage.addType(this._type, this._schema); - } - - constructor() { - this._type = null; - this._schema = null; - this._fromStorage = false; - } - - _fromComplexObjectType(complexObjectType, jsObject) { - this._init(complexObjectType._typeName); - if (complexObjectType._template) { - this._setFields(complexObjectType, complexObjectType._template, jsObject); - } - } - - _init(typeName) { - this._type = new BinaryType(typeName); - this._schema = new BinarySchema(); - } - - _beforeModify() { - if (this._fromStorage) { - this._type = this._type.clone(); - this._schema = this._schema.clone(); - this._fromStorage = false; - } - } - - _setFields(complexObjectType, objectTemplate, jsObject) { - let fieldType; - for (let fieldName of BinaryUtils.getJsObjectFieldNames(objectTemplate)) { - fieldType = complexObjectType._getFieldType(fieldName); - if (!fieldType && jsObject[fieldName]) { - fieldType = BinaryUtils.calcObjectType(jsObject[fieldName]); - } - this.setField(fieldName, BinaryUtils.getTypeCode(fieldType)); - } - } -} - -module.exports = BinaryType; -module.exports.BinaryField = BinaryField; -module.exports.BinaryTypeBuilder = BinaryTypeBuilder; diff --git a/modules/platforms/nodejs/lib/internal/BinaryTypeStorage.js b/modules/platforms/nodejs/lib/internal/BinaryTypeStorage.js deleted file mode 100644 index 2248eb5800e27..0000000000000 --- a/modules/platforms/nodejs/lib/internal/BinaryTypeStorage.js +++ /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. - */ - -'use strict'; - -const Errors = require('../Errors'); -const BinaryUtils = require('./BinaryUtils'); -const Util = require('util'); - -class BinaryTypeStorage { - - constructor(communicator) { - this._communicator = communicator; - this._types = new Map(); - } - - static getByComplexObjectType(complexObjectType) { - return BinaryTypeStorage.complexObjectTypes.get(complexObjectType); - } - - static setByComplexObjectType(complexObjectType, type, schema) { - if (!BinaryTypeStorage.complexObjectTypes.has(complexObjectType)) { - BinaryTypeStorage.complexObjectTypes.set(complexObjectType, [type, schema]); - } - } - - static get complexObjectTypes() { - if (!BinaryTypeStorage._complexObjectTypes) { - BinaryTypeStorage._complexObjectTypes = new Map(); - } - return BinaryTypeStorage._complexObjectTypes; - } - - async addType(binaryType, binarySchema) { - const typeId = binaryType.id; - const schemaId = binarySchema.id; - let storageType = this._types.get(typeId); - if (!storageType || !storageType.hasSchema(schemaId)) { - binaryType.addSchema(binarySchema); - if (!storageType) { - this._types.set(typeId, binaryType); - storageType = binaryType; - } - else { - storageType.merge(binaryType, binarySchema); - } - await this._putBinaryType(binaryType); - } - } - - async getType(typeId, schemaId = null) { - let storageType = this._types.get(typeId); - if (!storageType || schemaId && !storageType.hasSchema(schemaId)) { - storageType = await this._getBinaryType(typeId); - if (storageType) { - this._types.set(storageType.id, storageType); - } - } - return storageType; - } - - /** Private methods */ - - async _getBinaryType(typeId) { - const BinaryType = require('./BinaryType'); - let binaryType = new BinaryType(null); - binaryType._id = typeId; - await this._communicator.send( - BinaryUtils.OPERATION.GET_BINARY_TYPE, - async (payload) => { - payload.writeInteger(typeId); - }, - async (payload) => { - const exist = payload.readBoolean(); - if (exist) { - await binaryType._read(payload); - } - else { - binaryType = null; - } - }); - return binaryType; - } - - async _putBinaryType(binaryType) { - if (!binaryType.isValid()) { - throw Errors.IgniteClientError.serializationError( - true, Util.format('type "%d" can not be registered', binaryType.id)); - } - await this._communicator.send( - BinaryUtils.OPERATION.PUT_BINARY_TYPE, - async (payload) => { - await binaryType._write(payload); - }); - } -} - -module.exports = BinaryTypeStorage; diff --git a/modules/platforms/nodejs/lib/internal/BinaryUtils.js b/modules/platforms/nodejs/lib/internal/BinaryUtils.js deleted file mode 100644 index fe1e4034a9958..0000000000000 --- a/modules/platforms/nodejs/lib/internal/BinaryUtils.js +++ /dev/null @@ -1,602 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -'use strict'; - -const Decimal = require('decimal.js'); -const ObjectType = require('../ObjectType').ObjectType; -const CompositeType = require('../ObjectType').CompositeType; -const MapObjectType = require('../ObjectType').MapObjectType; -const CollectionObjectType = require('../ObjectType').CollectionObjectType; -const ComplexObjectType = require('../ObjectType').ComplexObjectType; -const ObjectArrayType = require('../ObjectType').ObjectArrayType; -const Timestamp = require('../Timestamp'); -const EnumItem = require('../EnumItem'); -const Errors = require('../Errors'); -const ArgumentChecker = require('./ArgumentChecker'); - -// Operation codes -const OPERATION = Object.freeze({ - // Key-Value Queries - CACHE_GET : 1000, - CACHE_PUT : 1001, - CACHE_PUT_IF_ABSENT : 1002, - CACHE_GET_ALL : 1003, - CACHE_PUT_ALL : 1004, - CACHE_GET_AND_PUT : 1005, - CACHE_GET_AND_REPLACE : 1006, - CACHE_GET_AND_REMOVE : 1007, - CACHE_GET_AND_PUT_IF_ABSENT : 1008, - CACHE_REPLACE : 1009, - CACHE_REPLACE_IF_EQUALS : 1010, - CACHE_CONTAINS_KEY : 1011, - CACHE_CONTAINS_KEYS : 1012, - CACHE_CLEAR : 1013, - CACHE_CLEAR_KEY : 1014, - CACHE_CLEAR_KEYS : 1015, - CACHE_REMOVE_KEY : 1016, - CACHE_REMOVE_IF_EQUALS : 1017, - CACHE_REMOVE_KEYS : 1018, - CACHE_REMOVE_ALL : 1019, - CACHE_GET_SIZE : 1020, - // Cache Configuration - CACHE_GET_NAMES : 1050, - CACHE_CREATE_WITH_NAME : 1051, - CACHE_GET_OR_CREATE_WITH_NAME : 1052, - CACHE_CREATE_WITH_CONFIGURATION : 1053, - CACHE_GET_OR_CREATE_WITH_CONFIGURATION : 1054, - CACHE_GET_CONFIGURATION : 1055, - CACHE_DESTROY : 1056, - // SQL and Scan Queries - QUERY_SCAN : 2000, - QUERY_SCAN_CURSOR_GET_PAGE : 2001, - QUERY_SQL : 2002, - QUERY_SQL_CURSOR_GET_PAGE : 2003, - QUERY_SQL_FIELDS : 2004, - QUERY_SQL_FIELDS_CURSOR_GET_PAGE : 2005, - RESOURCE_CLOSE : 0, - // Binary Types - GET_BINARY_TYPE : 3002, - PUT_BINARY_TYPE : 3003 -}); - -const TYPE_CODE = Object.assign({ - BINARY_OBJECT : 27, - BINARY_ENUM : 38 - }, - ObjectType.PRIMITIVE_TYPE, - ObjectType.COMPOSITE_TYPE); - - -const TYPE_INFO = Object.freeze({ - [TYPE_CODE.BYTE] : { - NAME : 'byte', - SIZE : 1 - }, - [TYPE_CODE.SHORT] : { - NAME : 'short', - SIZE : 2 - }, - [TYPE_CODE.INTEGER] : { - NAME : 'integer', - SIZE : 4 - }, - [TYPE_CODE.LONG] : { - NAME : 'long', - SIZE : 8 - }, - [TYPE_CODE.FLOAT] : { - NAME : 'float', - SIZE : 4 - }, - [TYPE_CODE.DOUBLE] : { - NAME : 'double', - SIZE : 8 - }, - [TYPE_CODE.CHAR] : { - NAME : 'char', - SIZE : 2 - }, - [TYPE_CODE.BOOLEAN] : { - NAME : 'boolean', - SIZE : 1 - }, - [TYPE_CODE.STRING] : { - NAME : 'string', - NULLABLE : true - }, - [TYPE_CODE.UUID] : { - NAME : 'UUID', - SIZE : 16, - NULLABLE : true - }, - [TYPE_CODE.DATE] : { - NAME : 'date', - SIZE : 8, - NULLABLE : true - }, - [TYPE_CODE.BYTE_ARRAY] : { - NAME : 'byte array', - ELEMENT_TYPE : TYPE_CODE.BYTE, - NULLABLE : true - }, - [TYPE_CODE.SHORT_ARRAY] : { - NAME : 'short array', - ELEMENT_TYPE : TYPE_CODE.SHORT, - NULLABLE : true - }, - [TYPE_CODE.INTEGER_ARRAY] : { - NAME : 'integer array', - ELEMENT_TYPE : TYPE_CODE.INTEGER, - NULLABLE : true - }, - [TYPE_CODE.LONG_ARRAY] : { - NAME : 'long array', - ELEMENT_TYPE : TYPE_CODE.LONG, - NULLABLE : true - }, - [TYPE_CODE.FLOAT_ARRAY] : { - NAME : 'float array', - ELEMENT_TYPE : TYPE_CODE.FLOAT, - NULLABLE : true - }, - [TYPE_CODE.DOUBLE_ARRAY] : { - NAME : 'double array', - ELEMENT_TYPE : TYPE_CODE.DOUBLE, - NULLABLE : true - }, - [TYPE_CODE.CHAR_ARRAY] : { - NAME : 'char array', - ELEMENT_TYPE : TYPE_CODE.CHAR, - NULLABLE : true - }, - [TYPE_CODE.BOOLEAN_ARRAY] : { - NAME : 'boolean array', - ELEMENT_TYPE : TYPE_CODE.BOOLEAN, - NULLABLE : true - }, - [TYPE_CODE.STRING_ARRAY] : { - NAME : 'string array', - ELEMENT_TYPE : TYPE_CODE.STRING, - KEEP_ELEMENT_TYPE : true, - NULLABLE : true - }, - [TYPE_CODE.DATE_ARRAY] : { - NAME : 'date array', - ELEMENT_TYPE : TYPE_CODE.DATE, - KEEP_ELEMENT_TYPE : true, - NULLABLE : true - }, - [TYPE_CODE.UUID_ARRAY] : { - NAME : 'UUID array', - ELEMENT_TYPE : TYPE_CODE.UUID, - KEEP_ELEMENT_TYPE : true, - NULLABLE : true - }, - [TYPE_CODE.OBJECT_ARRAY] : { - NAME : 'object array', - ELEMENT_TYPE : TYPE_CODE.COMPLEX_OBJECT, - KEEP_ELEMENT_TYPE : true, - NULLABLE : true - }, - [TYPE_CODE.COLLECTION] : { - NAME : 'collection', - NULLABLE : true - }, - [TYPE_CODE.MAP] : { - NAME : 'map', - NULLABLE : true - }, - [TYPE_CODE.BINARY_OBJECT] : { - NAME : 'BinaryObject', - NULLABLE : true - }, - [TYPE_CODE.ENUM] : { - NAME : 'enum', - NULLABLE : true - }, - [TYPE_CODE.ENUM_ARRAY] : { - NAME : 'enum array', - ELEMENT_TYPE : TYPE_CODE.ENUM, - KEEP_ELEMENT_TYPE : true, - NULLABLE : true - }, - [TYPE_CODE.DECIMAL] : { - NAME : 'decimal', - NULLABLE : true - }, - [TYPE_CODE.DECIMAL_ARRAY] : { - NAME : 'decimal array', - ELEMENT_TYPE : TYPE_CODE.DECIMAL, - KEEP_ELEMENT_TYPE : true, - NULLABLE : true - }, - [TYPE_CODE.TIMESTAMP] : { - NAME : 'timestamp', - NULLABLE : true - }, - [TYPE_CODE.TIMESTAMP_ARRAY] : { - NAME : 'timestamp array', - ELEMENT_TYPE : TYPE_CODE.TIMESTAMP, - KEEP_ELEMENT_TYPE : true, - NULLABLE : true - }, - [TYPE_CODE.TIME] : { - NAME : 'time', - NULLABLE : true - }, - [TYPE_CODE.TIME_ARRAY] : { - NAME : 'time array', - ELEMENT_TYPE : TYPE_CODE.TIME, - KEEP_ELEMENT_TYPE : true, - NULLABLE : true - }, - [TYPE_CODE.NULL] : { - NAME : 'null', - NULLABLE : true - }, - [TYPE_CODE.COMPLEX_OBJECT] : { - NAME : 'complex object', - NULLABLE : true - } -}); - -const UTF8_ENCODING = 'utf8'; - -class BinaryUtils { - static get OPERATION() { - return OPERATION; - } - - static get TYPE_CODE() { - return TYPE_CODE; - } - - static get TYPE_INFO() { - return TYPE_INFO; - } - - static getSize(typeCode) { - const size = TYPE_INFO[typeCode].SIZE; - return size ? size : 0; - } - - static get ENCODING() { - return UTF8_ENCODING; - } - - static getTypeName(type) { - if (typeof type === 'string') { - return type; - } - const typeCode = BinaryUtils.getTypeCode(type); - return TYPE_INFO[typeCode] ? TYPE_INFO[typeCode].NAME : 'type code ' + typeCode; - } - - static isNullable(type) { - return TYPE_INFO[BinaryUtils.getTypeCode(type)].NULLABLE === true; - } - - static getTypeCode(type) { - return type instanceof CompositeType ? type._typeCode : type; - } - - static checkObjectType(type, argName) { - if (type === null || type instanceof CompositeType) { - return; - } - ArgumentChecker.hasValueFrom(type, argName, false, ObjectType.PRIMITIVE_TYPE); - } - - static calcObjectType(object) { - const BinaryObject = require('../BinaryObject'); - const objectType = typeof object; - if (object === null) { - throw Errors.IgniteClientError.unsupportedTypeError(BinaryUtils.TYPE_CODE.NULL); - } - else if (objectType === 'number') { - return BinaryUtils.TYPE_CODE.DOUBLE; - } - else if (objectType === 'string') { - return BinaryUtils.TYPE_CODE.STRING; - } - else if (objectType === 'boolean') { - return BinaryUtils.TYPE_CODE.BOOLEAN; - } - else if (object instanceof Timestamp) { - return BinaryUtils.TYPE_CODE.TIMESTAMP; - } - else if (object instanceof Date) { - return BinaryUtils.TYPE_CODE.DATE; - } - else if (object instanceof EnumItem) { - return BinaryUtils.TYPE_CODE.ENUM; - } - else if (object instanceof Decimal) { - return BinaryUtils.TYPE_CODE.DECIMAL; - } - else if (object instanceof Array) { - if (object.length > 0 && object[0] !== null) { - return BinaryUtils.getArrayType(BinaryUtils.calcObjectType(object[0])); - } - } - else if (object instanceof Set) { - return new CollectionObjectType(CollectionObjectType.COLLECTION_SUBTYPE.HASH_SET); - } - else if (object instanceof Map) { - return new MapObjectType(); - } - else if (object instanceof BinaryObject) { - return BinaryUtils.TYPE_CODE.BINARY_OBJECT; - } - else if (objectType === 'object') { - return new ComplexObjectType(object); - } - throw Errors.IgniteClientError.unsupportedTypeError(objectType); - } - - static checkCompatibility(value, type) { - if (!type) { - return; - } - const typeCode = BinaryUtils.getTypeCode(type); - if (value === null) { - if (!BinaryUtils.isNullable(typeCode)) { - throw Errors.IgniteClientError.typeCastError(BinaryUtils.TYPE_CODE.NULL, typeCode); - } - return; - } - else if (BinaryUtils.isStandardType(typeCode)) { - BinaryUtils.checkStandardTypeCompatibility(value, typeCode, type); - return; - } - const valueTypeCode = BinaryUtils.getTypeCode(BinaryUtils.calcObjectType(value)); - if (typeCode !== valueTypeCode) { - throw Errors.IgniteClientError.typeCastError(valueTypeCode, typeCode); - } - } - - static isStandardType(typeCode) { - return typeCode !== BinaryUtils.TYPE_CODE.BINARY_OBJECT && - typeCode !== BinaryUtils.TYPE_CODE.COMPLEX_OBJECT; - } - - static checkStandardTypeCompatibility(value, typeCode, type = null) { - const valueType = typeof value; - switch (typeCode) { - case BinaryUtils.TYPE_CODE.BYTE: - case BinaryUtils.TYPE_CODE.SHORT: - case BinaryUtils.TYPE_CODE.INTEGER: - case BinaryUtils.TYPE_CODE.LONG: - if (!Number.isInteger(value)) { - throw Errors.IgniteClientError.valueCastError(value, typeCode); - } - return; - case BinaryUtils.TYPE_CODE.FLOAT: - case BinaryUtils.TYPE_CODE.DOUBLE: - if (valueType !== 'number') { - throw Errors.IgniteClientError.valueCastError(value, typeCode); - } - return; - case BinaryUtils.TYPE_CODE.CHAR: - if (valueType !== 'string' || value.length !== 1) { - throw Errors.IgniteClientError.valueCastError(value, typeCode); - } - return; - case BinaryUtils.TYPE_CODE.BOOLEAN: - if (valueType !== 'boolean') { - throw Errors.IgniteClientError.valueCastError(value, typeCode); - } - return; - case BinaryUtils.TYPE_CODE.STRING: - if (valueType !== 'string') { - throw Errors.IgniteClientError.valueCastError(value, typeCode); - } - return; - case BinaryUtils.TYPE_CODE.UUID: - if (!value instanceof Array || - value.length !== BinaryUtils.getSize(BinaryUtils.TYPE_CODE.UUID)) { - throw Errors.IgniteClientError.valueCastError(value, typeCode); - } - value.forEach(element => - BinaryUtils.checkStandardTypeCompatibility(element, BinaryUtils.TYPE_CODE.BYTE)); - return; - case BinaryUtils.TYPE_CODE.DATE: - if (!value instanceof Date) { - throw Errors.IgniteClientError.valueCastError(value, typeCode); - } - return; - case BinaryUtils.TYPE_CODE.ENUM: - if (!value instanceof EnumItem) { - throw Errors.IgniteClientError.valueCastError(value, typeCode); - } - return; - case BinaryUtils.TYPE_CODE.DECIMAL: - if (!value instanceof Decimal) { - throw Errors.IgniteClientError.valueCastError(value, typeCode); - } - return; - case BinaryUtils.TYPE_CODE.TIMESTAMP: - if (!value instanceof Timestamp) { - throw Errors.IgniteClientError.valueCastError(value, typeCode); - } - return; - case BinaryUtils.TYPE_CODE.TIME: - if (!value instanceof Date) { - throw Errors.IgniteClientError.valueCastError(value, typeCode); - } - return; - case BinaryUtils.TYPE_CODE.BYTE_ARRAY: - case BinaryUtils.TYPE_CODE.SHORT_ARRAY: - case BinaryUtils.TYPE_CODE.INTEGER_ARRAY: - case BinaryUtils.TYPE_CODE.LONG_ARRAY: - case BinaryUtils.TYPE_CODE.FLOAT_ARRAY: - case BinaryUtils.TYPE_CODE.DOUBLE_ARRAY: - case BinaryUtils.TYPE_CODE.CHAR_ARRAY: - case BinaryUtils.TYPE_CODE.BOOLEAN_ARRAY: - case BinaryUtils.TYPE_CODE.STRING_ARRAY: - case BinaryUtils.TYPE_CODE.UUID_ARRAY: - case BinaryUtils.TYPE_CODE.DATE_ARRAY: - case BinaryUtils.TYPE_CODE.OBJECT_ARRAY: - case BinaryUtils.TYPE_CODE.ENUM_ARRAY: - case BinaryUtils.TYPE_CODE.DECIMAL_ARRAY: - case BinaryUtils.TYPE_CODE.TIMESTAMP_ARRAY: - case BinaryUtils.TYPE_CODE.TIME_ARRAY: - if (!value instanceof Array) { - throw Errors.IgniteClientError.typeCastError(valueType, typeCode); - } - return; - case BinaryUtils.TYPE_CODE.MAP: - if (!value instanceof Map) { - throw Errors.IgniteClientError.typeCastError(valueType, typeCode); - } - return; - case BinaryUtils.TYPE_CODE.COLLECTION: - if (!(type && type._isSet() && value instanceof Set || value instanceof Array)) { - throw Errors.IgniteClientError.typeCastError(valueType, type && type._isSet() ? 'set' : typeCode); - } - return; - case BinaryUtils.TYPE_CODE.NULL: - if (value !== null) { - throw Errors.IgniteClientError.typeCastError('not null', typeCode); - } - return; - default: - const valueTypeCode = BinaryUtils.getTypeCode(BinaryUtils.calcObjectType(value)); - if (valueTypeCode === BinaryUtils.TYPE_CODE.BINARY_OBJECT) { - throw Errors.IgniteClientError.typeCastError(valueTypeCode, typeCode); - } - return; - } - } - - static checkTypesComatibility(expectedType, actualTypeCode) { - if (expectedType === null) { - return; - } - const expectedTypeCode = BinaryUtils.getTypeCode(expectedType); - if (actualTypeCode === BinaryUtils.TYPE_CODE.NULL) { - return; - } - else if (expectedTypeCode === BinaryUtils.TYPE_CODE.BINARY_OBJECT || - actualTypeCode === BinaryUtils.TYPE_CODE.BINARY_OBJECT && - expectedTypeCode === BinaryUtils.TYPE_CODE.COMPLEX_OBJECT) { - return; - } - else if (expectedTypeCode === BinaryUtils.TYPE_CODE.ENUM && - actualTypeCode === BinaryUtils.TYPE_CODE.BINARY_ENUM) { - return; - } - else if (actualTypeCode !== expectedTypeCode) { - throw Errors.IgniteClientError.typeCastError(actualTypeCode, expectedTypeCode); - } - } - - static getArrayElementType(arrayType) { - if (arrayType instanceof ObjectArrayType) { - return arrayType._elementType; - } - else if (arrayType === BinaryUtils.TYPE_CODE.OBJECT_ARRAY) { - return null; - } - const elementTypeCode = TYPE_INFO[arrayType].ELEMENT_TYPE; - if (!elementTypeCode) { - throw Errors.IgniteClientError.internalError(); - } - return elementTypeCode; - } - - static getArrayType(elementType) { - switch (BinaryUtils.getTypeCode(elementType)) { - case BinaryUtils.TYPE_CODE.BYTE: - return BinaryUtils.TYPE_CODE.BYTE_ARRAY; - case BinaryUtils.TYPE_CODE.SHORT: - return BinaryUtils.TYPE_CODE.SHORT_ARRAY; - case BinaryUtils.TYPE_CODE.INTEGER: - return BinaryUtils.TYPE_CODE.INTEGER_ARRAY; - case BinaryUtils.TYPE_CODE.LONG: - return BinaryUtils.TYPE_CODE.LONG_ARRAY; - case BinaryUtils.TYPE_CODE.FLOAT: - return BinaryUtils.TYPE_CODE.FLOAT_ARRAY; - case BinaryUtils.TYPE_CODE.DOUBLE: - return BinaryUtils.TYPE_CODE.DOUBLE_ARRAY; - case BinaryUtils.TYPE_CODE.CHAR: - return BinaryUtils.TYPE_CODE.CHAR_ARRAY; - case BinaryUtils.TYPE_CODE.BOOLEAN: - return BinaryUtils.TYPE_CODE.BOOLEAN_ARRAY; - case BinaryUtils.TYPE_CODE.STRING: - return BinaryUtils.TYPE_CODE.STRING_ARRAY; - case BinaryUtils.TYPE_CODE.UUID: - return BinaryUtils.TYPE_CODE.UUID_ARRAY; - case BinaryUtils.TYPE_CODE.DATE: - return BinaryUtils.TYPE_CODE.DATE_ARRAY; - case BinaryUtils.TYPE_CODE.ENUM: - return BinaryUtils.TYPE_CODE.ENUM_ARRAY; - case BinaryUtils.TYPE_CODE.DECIMAL: - return BinaryUtils.TYPE_CODE.DECIMAL_ARRAY; - case BinaryUtils.TYPE_CODE.TIMESTAMP: - return BinaryUtils.TYPE_CODE.TIMESTAMP_ARRAY; - case BinaryUtils.TYPE_CODE.TIME: - return BinaryUtils.TYPE_CODE.TIME_ARRAY; - case BinaryUtils.TYPE_CODE.BINARY_OBJECT: - return new ObjectArrayType(); - default: - return new ObjectArrayType(elementType); - } - } - - static keepArrayElementType(arrayTypeCode) { - return TYPE_INFO[arrayTypeCode].KEEP_ELEMENT_TYPE === true; - } - - static getJsObjectFieldNames(jsObject) { - var fields = new Array(); - for (let field in jsObject) { - if (typeof jsObject[field] !== 'function') { - fields.push(field); - } - } - return fields; - } - - static hashCode(str) { - let hash = 0, char; - if (str && str.length > 0) { - for (let i = 0; i < str.length; i++) { - char = str.charCodeAt(i); - hash = ((hash << 5) - hash) + char; - hash |= 0; // Convert to 32bit integer - } - } - return hash; - } - - static hashCodeLowerCase(str) { - return BinaryUtils.hashCode(str ? str.toLowerCase() : str); - } - - static contentHashCode(buffer, startPos, endPos) { - let hash = 1; - for (let i = startPos; i <= endPos; i++) { - hash = 31 * hash + buffer._buffer[i]; - hash |= 0; // Convert to 32bit integer - } - return hash; - } -} - -module.exports = BinaryUtils; diff --git a/modules/platforms/nodejs/lib/internal/ClientFailoverSocket.js b/modules/platforms/nodejs/lib/internal/ClientFailoverSocket.js deleted file mode 100644 index 770c5c647c81b..0000000000000 --- a/modules/platforms/nodejs/lib/internal/ClientFailoverSocket.js +++ /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. - */ - -'use strict'; - -const Util = require('util'); -const Errors = require('../Errors'); -const IgniteClient = require('../IgniteClient'); -const ClientSocket = require('./ClientSocket'); -const Logger = require('./Logger'); - -/** Socket wrapper with failover functionality: reconnects on failure. */ -class ClientFailoverSocket { - - constructor(onStateChanged) { - this._socket = null; - this._state = IgniteClient.STATE.DISCONNECTED; - this._onStateChanged = onStateChanged; - } - - async connect(config) { - if (this._state !== IgniteClient.STATE.DISCONNECTED) { - throw new Errors.IllegalStateError(); - } - this._config = config; - this._endpointsNumber = this._config._endpoints.length; - this._endpointIndex = this._getRandomInt(this._endpointsNumber - 1); - await this._connect(); - } - - async send(opCode, payloadWriter, payloadReader = null) { - if (this._state !== IgniteClient.STATE.CONNECTED) { - throw new Errors.IllegalStateError(); - } - await this._socket.sendRequest(opCode, payloadWriter, payloadReader); - } - - disconnect() { - if (this._state !== IgniteClient.STATE.DISCONNECTED) { - this._changeState(IgniteClient.STATE.DISCONNECTED); - if (this._socket) { - this._socket.disconnect(); - this._socket = null; - } - } - } - - async _onSocketDisconnect(error = null) { - this._changeState(IgniteClient.STATE.CONNECTING, null, error); - this._socket = null; - this._endpointIndex++; - try { - await this._connect(); - } - catch (err) { - } - } - - async _connect() { - const errors = new Array(); - let index, endpoint; - for (let i = 0; i < this._endpointsNumber; i++) { - index = (this._endpointIndex + i) % this._endpointsNumber; - endpoint = this._config._endpoints[index]; - try { - this._changeState(IgniteClient.STATE.CONNECTING, endpoint); - this._socket = new ClientSocket( - endpoint, this._config, this._onSocketDisconnect.bind(this)); - await this._socket.connect(); - this._changeState(IgniteClient.STATE.CONNECTED, endpoint); - return; - } - catch (err) { - errors.push(Util.format('[%s] %s', endpoint, err.message)); - } - } - const error = errors.join('; '); - this._changeState(IgniteClient.STATE.DISCONNECTED, endpoint, error); - this._socket = null; - throw new Errors.IgniteClientError(error); - } - - _changeState(state, endpoint = null, reason = null) { - if (Logger.debug) { - Logger.logDebug(Util.format('Socket %s: %s -> %s'), - endpoint ? endpoint : this._socket ? this._socket._endpoint : '', - this._getState(this._state), - this._getState(state)); - } - if (this._state !== state) { - this._state = state; - if (this._onStateChanged) { - this._onStateChanged(state, reason); - } - } - } - - _getState(state) { - switch (state) { - case IgniteClient.STATE.DISCONNECTED: - return 'DISCONNECTED'; - case IgniteClient.STATE.CONNECTING: - return 'CONNECTING'; - case IgniteClient.STATE.CONNECTED: - return 'CONNECTED'; - default: - return 'UNKNOWN'; - } - } - - // returns a random integer between 0 and max - _getRandomInt(max) { - if (max === 0) { - return 0; - } - return Math.floor(Math.random() * (max + 1)); - } -} - -module.exports = ClientFailoverSocket; diff --git a/modules/platforms/nodejs/lib/internal/ClientSocket.js b/modules/platforms/nodejs/lib/internal/ClientSocket.js deleted file mode 100644 index 73e11f06120cd..0000000000000 --- a/modules/platforms/nodejs/lib/internal/ClientSocket.js +++ /dev/null @@ -1,454 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -'use strict'; - -const net = require('net'); -const tls = require('tls'); -const URL = require('url'); -const Long = require('long'); -const Util = require('util'); -const Errors = require('../Errors'); -const IgniteClientConfiguration = require('../IgniteClientConfiguration'); -const MessageBuffer = require('./MessageBuffer'); -const BinaryUtils = require('./BinaryUtils'); -const BinaryCommunicator = require('./BinaryCommunicator'); -const ArgumentChecker = require('./ArgumentChecker'); -const Logger = require('./Logger'); - -const HANDSHAKE_SUCCESS_STATUS_CODE = 1; -const REQUEST_SUCCESS_STATUS_CODE = 0; -const PORT_DEFAULT = 10800; - -class ProtocolVersion { - - constructor(major = null, minor = null, patch = null) { - this._major = major; - this._minor = minor; - this._patch = patch; - } - - compareTo(other) { - let diff = this._major - other._major; - if (diff !== 0) { - return diff; - } - diff = this._minor - other._minor; - if (diff !== 0) { - return diff; - } - return this._patch - other._patch; - } - - equals(other) { - return this.compareTo(other) === 0; - } - - toString() { - return Util.format('%d.%d.%d', this._major, this._minor, this._patch); - } - - read(buffer) { - this._major = buffer.readShort(); - this._minor = buffer.readShort(); - this._patch = buffer.readShort(); - } - - write(buffer) { - buffer.writeShort(this._major); - buffer.writeShort(this._minor); - buffer.writeShort(this._patch); - } -} - -const PROTOCOL_VERSION_1_0_0 = new ProtocolVersion(1, 0, 0); -const PROTOCOL_VERSION_1_1_0 = new ProtocolVersion(1, 1, 0); -const PROTOCOL_VERSION_1_2_0 = new ProtocolVersion(1, 2, 0); - -const SUPPORTED_VERSIONS = [ - // PROTOCOL_VERSION_1_0_0, // Support for QueryField precision/scale fields breaks 1.0.0 compatibility - PROTOCOL_VERSION_1_1_0, - PROTOCOL_VERSION_1_2_0 -]; - -const CURRENT_VERSION = PROTOCOL_VERSION_1_2_0; - -const STATE = Object.freeze({ - INITIAL : 0, - HANDSHAKE : 1, - CONNECTED : 2, - DISCONNECTED : 3 -}); - -class ClientSocket { - - constructor(endpoint, config, onSocketDisconnect) { - ArgumentChecker.notEmpty(endpoint, 'endpoints'); - this._endpoint = endpoint; - this._parseEndpoint(endpoint); - this._config = config; - this._state = STATE.INITIAL; - this._socket = null; - this._requestId = Long.ZERO; - this._handshakeRequestId = null; - this._protocolVersion = null; - this._requests = new Map(); - this._onSocketDisconnect = onSocketDisconnect; - this._error = null; - this._wasConnected = false; - this._buffer = null; - this._offset = 0; - } - - async connect() { - return new Promise((resolve, reject) => { - this._connectSocket( - this._getHandshake(CURRENT_VERSION, resolve, reject)); - }); - } - - disconnect() { - this._disconnect(true, false); - } - - get requestId() { - const id = this._requestId; - this._requestId = this._requestId.add(1); - return id; - } - - async sendRequest(opCode, payloadWriter, payloadReader = null) { - if (this._state === STATE.CONNECTED) { - return new Promise(async (resolve, reject) => { - const request = new Request(this.requestId, opCode, payloadWriter, payloadReader, resolve, reject); - this._addRequest(request); - await this._sendRequest(request); - }); - } - else { - throw new Errors.IllegalStateError(); - } - } - - _connectSocket(handshakeRequest) { - const onConnected = async () => { - this._state = STATE.HANDSHAKE; - // send handshake - await this._sendRequest(handshakeRequest); - }; - - const options = Object.assign({}, - this._config._options, - { host : this._host, port : this._port, version : this._version }); - if (this._config._useTLS) { - this._socket = tls.connect(options, onConnected); - } - else { - this._socket = net.createConnection(options, onConnected); - } - - this._socket.on('data', async (data) => { - try { - await this._processResponse(data); - } - catch (err) { - this._error = err.message; - this._disconnect(); - } - }); - this._socket.on('close', () => { - this._disconnect(false); - }); - this._socket.on('error', (error) => { - this._error = this._state === STATE.INITIAL ? - 'Connection failed: ' + error : error; - this._disconnect(); - }); - } - - _addRequest(request) { - this._requests.set(request.id.toString(), request); - } - - async _sendRequest(request) { - try { - const message = await request.getMessage(); - this._logMessage(request.id.toString(), true, message); - this._socket.write(message); - } - catch (err) { - this._requests.delete(request.id); - request.reject(err); - } - } - - async _processResponse(message) { - if (this._state === STATE.DISCONNECTED) { - return; - } - if (this._buffer) { - this._buffer.concat(message); - this._buffer.position = this._offset; - } - else { - this._buffer = MessageBuffer.from(message, 0); - } - while (this._buffer && this._offset < this._buffer.length) { - // Response length - const length = this._buffer.readInteger() + BinaryUtils.getSize(BinaryUtils.TYPE_CODE.INTEGER); - if (this._buffer.length < this._offset + length) { - break; - } - this._offset += length; - - let requestId, isSuccess; - const isHandshake = this._state === STATE.HANDSHAKE; - - if (isHandshake) { - // Handshake status - isSuccess = (this._buffer.readByte() === HANDSHAKE_SUCCESS_STATUS_CODE); - requestId = this._handshakeRequestId.toString(); - } - else { - // Request id - requestId = this._buffer.readLong().toString(); - // Status code - isSuccess = (this._buffer.readInteger() === REQUEST_SUCCESS_STATUS_CODE); - } - - this._logMessage(requestId, false, this._buffer.data); - - const buffer = this._buffer; - if (this._offset === this._buffer.length) { - this._buffer = null; - this._offset = 0; - } - - if (this._requests.has(requestId)) { - const request = this._requests.get(requestId); - this._requests.delete(requestId); - if (isHandshake) { - await this._finalizeHandshake(buffer, request, isSuccess); - } - else { - await this._finalizeResponse(buffer, request, isSuccess); - } - } - else { - throw Errors.IgniteClientError.internalError('Invalid response id: ' + requestId); - } - } - } - - async _finalizeHandshake(buffer, request, isSuccess) { - if (!isSuccess) { - // Server protocol version - const serverVersion = new ProtocolVersion(); - serverVersion.read(buffer); - // Error message - const errMessage = BinaryCommunicator.readString(buffer); - - if (!this._protocolVersion.equals(serverVersion)) { - if (!this._isSupportedVersion(serverVersion) || - serverVersion.compareTo(PROTOCOL_VERSION_1_1_0) < 0 && this._config._userName) { - request.reject(new Errors.OperationError( - Util.format('Protocol version mismatch: client %s / server %s. Server details: %s', - this._protocolVersion.toString(), serverVersion.toString(), errMessage))); - this._disconnect(); - } - else { - // retry handshake with server version - const handshakeRequest = this._getHandshake(serverVersion, request.resolve, request.reject); - await this._sendRequest(handshakeRequest); - } - } - else { - request.reject(new Errors.OperationError(errMessage)); - this._disconnect(); - } - } - else { - this._state = STATE.CONNECTED; - this._wasConnected = true; - request.resolve(); - } - } - - async _finalizeResponse(buffer, request, isSuccess) { - if (!isSuccess) { - // Error message - const errMessage = BinaryCommunicator.readString(buffer); - request.reject(new Errors.OperationError(errMessage)); - } - else { - try { - if (request.payloadReader) { - await request.payloadReader(buffer); - } - request.resolve(); - } - catch (err) { - request.reject(err); - } - } - } - - async _handshakePayloadWriter(payload) { - // Handshake code - payload.writeByte(1); - // Protocol version - this._protocolVersion.write(payload); - // Client code - payload.writeByte(2); - if (this._config._userName) { - BinaryCommunicator.writeString(payload, this._config._userName); - BinaryCommunicator.writeString(payload, this._config._password); - } - } - - _getHandshake(version, resolve, reject) { - this._protocolVersion = version; - const handshakeRequest = new Request( - this.requestId, null, this._handshakePayloadWriter.bind(this), null, resolve, reject); - this._addRequest(handshakeRequest); - this._handshakeRequestId = handshakeRequest.id; - return handshakeRequest; - } - - _isSupportedVersion(protocolVersion) { - for (let version of SUPPORTED_VERSIONS) { - if (version.equals(protocolVersion)) { - return true; - } - } - return false; - } - - _disconnect(close = true, callOnDisconnect = true) { - this._state = STATE.DISCONNECTED; - this._requests.forEach((request, id) => { - request.reject(new Errors.LostConnectionError(this._error)); - this._requests.delete(id); - }); - if (this._wasConnected && callOnDisconnect && this._onSocketDisconnect) { - this._onSocketDisconnect(this._error); - } - if (close) { - this._onSocketDisconnect = null; - this._socket.end(); - } - } - - _parseEndpoint(endpoint) { - endpoint = endpoint.trim(); - this._host = endpoint; - this._port = null; - const colonCnt = endpoint.split(':').length - 1; - if (colonCnt > 1) { - // IPv6 address - this._version = 6; - const index = endpoint.lastIndexOf(']:'); - if (index >= 0) { - this._host = endpoint.substring(0, index + 1); - this._port = endpoint.substring(index + 2); - } - if (this._host.startsWith('[') || this._host.endsWith(']')) { - if (this._host.startsWith('[') && this._host.endsWith(']')) { - this._host = this._host.substring(1, this._host.length - 1); - } - else { - throw Errors.IgniteClientError.illegalArgumentError('Incorrect endpoint format: ' + endpoint); - } - } - } - else { - // IPv4 address - this._version = 4; - const index = endpoint.lastIndexOf(':'); - if (index >= 0) { - this._host = endpoint.substring(0, index); - this._port = endpoint.substring(index + 1); - } - } - if (!this._port) { - this._port = PORT_DEFAULT; - } - else { - this._port = parseInt(this._port); - if (isNaN(this._port)) { - throw Errors.IgniteClientError.illegalArgumentError('Incorrect endpoint format: ' + endpoint); - } - } - } - - _logMessage(requestId, isRequest, message) { - if (Logger.debug) { - Logger.logDebug((isRequest ? 'Request: ' : 'Response: ') + requestId); - Logger.logDebug('[' + [...message] + ']'); - } - } -} - -class Request { - constructor(id, opCode, payloadWriter, payloadReader, resolve, reject) { - this._id = id; - this._opCode = opCode; - this._payloadWriter = payloadWriter; - this._payloadReader = payloadReader; - this._resolve = resolve; - this._reject = reject; - } - - get id() { - return this._id; - } - - get payloadReader() { - return this._payloadReader; - } - - get resolve() { - return this._resolve; - } - - get reject() { - return this._reject; - } - - async getMessage() { - const message = new MessageBuffer(); - // Skip message length - const messageStartPos = BinaryUtils.getSize(BinaryUtils.TYPE_CODE.INTEGER); - message.position = messageStartPos; - if (this._opCode !== null) { - // Op code - message.writeShort(this._opCode); - // Request id - message.writeLong(this._id); - } - if (this._payloadWriter) { - // Payload - await this._payloadWriter(message); - } - // Message length - message.position = 0; - message.writeInteger(message.length - messageStartPos); - return message.data; - } -} - -module.exports = ClientSocket; diff --git a/modules/platforms/nodejs/lib/internal/Logger.js b/modules/platforms/nodejs/lib/internal/Logger.js deleted file mode 100644 index 628c70e6a6028..0000000000000 --- a/modules/platforms/nodejs/lib/internal/Logger.js +++ /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. - */ - -'use strict'; - -/** Utility class for logging errors and debug messages. */ -class Logger { - static get debug() { - return Logger._debug; - } - - static set debug(value) { - Logger._debug = value; - } - - static logDebug(data, ...args) { - if (Logger._debug) { - console.log(data, ...args); - } - } - - static logError(data, ...args) { - if (Logger._debug) { - console.log('ERROR: ' + data, ...args); - } - } -} - -Logger._debug = false; - -module.exports = Logger; diff --git a/modules/platforms/nodejs/lib/internal/MessageBuffer.js b/modules/platforms/nodejs/lib/internal/MessageBuffer.js deleted file mode 100644 index e2829672a29d6..0000000000000 --- a/modules/platforms/nodejs/lib/internal/MessageBuffer.js +++ /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. - */ - -'use strict'; - -const Long = require('long'); -const BinaryUtils = require('./BinaryUtils'); -const Errors = require('../Errors'); - -const BUFFER_CAPACITY_DEFAULT = 256; -const BYTE_ZERO = 0; -const BYTE_ONE = 1; - -class MessageBuffer { - constructor(capacity = BUFFER_CAPACITY_DEFAULT) { - this._buffer = Buffer.allocUnsafe(capacity); - this._capacity = capacity; - this._length = 0; - this._position = 0; - } - - static from(source, position) { - const buf = new MessageBuffer(); - buf._buffer = Buffer.from(source); - buf._position = position; - buf._length = buf._buffer.length; - buf._capacity = buf._length; - return buf; - } - - concat(source) { - this._buffer = Buffer.concat([this._buffer, source]); - this._length = this._buffer.length; - this._capacity = this._length; - } - - get position() { - return this._position; - } - - set position(position) { - this._position = position; - } - - get length() { - return this._length; - } - - get data() { - return this.getSlice(0, this.length); - } - - get buffer() { - return this._buffer; - } - - getSlice(start, end) { - return this._buffer.slice(start, end); - } - - writeByte(value) { - this.writeNumber(value, BinaryUtils.TYPE_CODE.BYTE); - } - - writeShort(value) { - this.writeNumber(value, BinaryUtils.TYPE_CODE.SHORT); - } - - writeInteger(value) { - this.writeNumber(value, BinaryUtils.TYPE_CODE.INTEGER); - } - - writeLong(value) { - try { - if (!Long.isLong(value)) { - value = Long.fromValue(value); - } - } - catch (err) { - throw Errors.IgniteClientError.valueCastError(value, BinaryUtils.TYPE_CODE.LONG); - } - const buffer = Buffer.from(value.toBytesLE()); - this.writeBuffer(buffer); - } - - writeFloat(value) { - this.writeNumber(value, BinaryUtils.TYPE_CODE.FLOAT); - } - - writeDouble(value) { - this.writeNumber(value, BinaryUtils.TYPE_CODE.DOUBLE); - } - - writeNumber(value, type, signed = true) { - const size = BinaryUtils.getSize(type); - this._ensureCapacity(size); - try { - switch (type) { - case BinaryUtils.TYPE_CODE.BYTE: - if (signed) { - this._buffer.writeInt8(value, this._position); - } - else { - this._buffer.writeUInt8(value, this._position); - } - break; - case BinaryUtils.TYPE_CODE.SHORT: - if (signed) { - this._buffer.writeInt16LE(value, this._position); - } - else { - this._buffer.writeUInt16LE(value, this._position); - } - break; - case BinaryUtils.TYPE_CODE.INTEGER: - if (signed) { - this._buffer.writeInt32LE(value, this._position); - } - else { - this._buffer.writeUInt32LE(value, this._position); - } - break; - case BinaryUtils.TYPE_CODE.FLOAT: - this._buffer.writeFloatLE(value, this._position); - break; - case BinaryUtils.TYPE_CODE.DOUBLE: - this._buffer.writeDoubleLE(value, this._position); - break; - default: - throw Errors.IgniteClientError.internalError(); - } - } - catch (err) { - throw Errors.IgniteClientError.valueCastError(value, type); - } - this._position += size; - } - - writeBoolean(value) { - this.writeByte(value ? BYTE_ONE : BYTE_ZERO); - } - - writeChar(value) { - this.writeShort(value.charCodeAt(0)); - } - - writeString(value) { - const buffer = Buffer.from(value, BinaryUtils.ENCODING); - const length = buffer.length; - this.writeInteger(length); - if (length > 0) { - this.writeBuffer(buffer); - } - } - - writeDate(value) { - this.writeLong(value.getTime()); - } - - readByte() { - return this.readNumber(BinaryUtils.TYPE_CODE.BYTE); - } - - readShort() { - return this.readNumber(BinaryUtils.TYPE_CODE.SHORT); - } - - readInteger() { - return this.readNumber(BinaryUtils.TYPE_CODE.INTEGER); - } - - readLong() { - const size = BinaryUtils.getSize(BinaryUtils.TYPE_CODE.LONG) - this._ensureSize(size); - const value = Long.fromBytesLE([...this._buffer.slice(this._position, this._position + size)]); - this._position += size; - return value; - } - - readFloat() { - return this.readNumber(BinaryUtils.TYPE_CODE.FLOAT); - } - - readDouble() { - return this.readNumber(BinaryUtils.TYPE_CODE.DOUBLE); - } - - readNumber(type, signed = true) { - const size = BinaryUtils.getSize(type); - this._ensureSize(size); - let value; - switch (type) { - case BinaryUtils.TYPE_CODE.BYTE: - value = signed ? this._buffer.readInt8(this._position) : this._buffer.readUInt8(this._position); - break; - case BinaryUtils.TYPE_CODE.SHORT: - value = signed ? this._buffer.readInt16LE(this._position) : this._buffer.readUInt16LE(this._position); - break; - case BinaryUtils.TYPE_CODE.INTEGER: - value = signed ? this._buffer.readInt32LE(this._position) : this._buffer.readUInt32LE(this._position); - break; - case BinaryUtils.TYPE_CODE.FLOAT: - value = this._buffer.readFloatLE(this._position); - break; - case BinaryUtils.TYPE_CODE.DOUBLE: - value = this._buffer.readDoubleLE(this._position); - break; - default: - throw Errors.IgniteClientError.internalError(); - } - this._position += size; - return value; - } - - readBoolean() { - return this.readByte() === BYTE_ONE; - } - - readChar() { - return String.fromCharCode(this.readShort()); - } - - readString() { - const bytesCount = this.readInteger(); - this._ensureSize(bytesCount); - const result = this._buffer.toString(BinaryUtils.ENCODING, this._position, this._position + bytesCount); - this._position += bytesCount; - return result; - } - - readBuffer(length) { - this._ensureSize(length); - const result = this._buffer.slice(this._position, this._position + length); - this._position += length; - return result; - } - - readDate() { - return new Date(this.readLong().toNumber()); - } - - writeBuffer(buffer, start = undefined, end = undefined) { - if (start === undefined) { - start = 0; - } - if (end === undefined) { - end = buffer.length; - } - const size = end - start; - this._ensureCapacity(size); - buffer.copy(this._buffer, this._position, start, end); - this._position += size; - } - - _ensureSize(size) { - if (this._position + size > this._length) { - throw Errors.IgniteClientError.internalError('Unexpected format of response'); - } - } - - _ensureCapacity(valueSize) { - if (valueSize <= 0) { - throw Errors.IgniteClientError.internalError(); - } - let newCapacity = this._capacity; - while (this._position + valueSize > newCapacity) { - newCapacity = newCapacity * 2; - } - if (this._capacity < newCapacity) { - this._buffer = Buffer.concat([this._buffer, Buffer.allocUnsafe(newCapacity - this._capacity)], newCapacity); - this._capacity = newCapacity; - } - if (this._position + valueSize > this._length) { - this._length = this._position + valueSize; - } - } -} - -module.exports = MessageBuffer; diff --git a/modules/platforms/nodejs/package.json b/modules/platforms/nodejs/package.json deleted file mode 100644 index dc6898cdf7e1b..0000000000000 --- a/modules/platforms/nodejs/package.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "apache-ignite-client", - "version": "1.0.1", - "description": "NodeJS Client for Apache Ignite", - "main": "index.js", - "files": [ - "/examples", - "/lib", - "index.js" - ], - "repository": { - "type": "git", - "url": "https://github.com/apache/ignite/tree/master/modules/platforms/nodejs" - }, - "keywords": [ - "apache", - "ignite", - "client" - ], - "author": "", - "license": "Apache-2.0", - "engines": { - "node": ">=8.0.0" - }, - "dependencies": { - "long": "latest", - "decimal.js": "latest" - }, - "scripts": { - "test": "jasmine", - "test:examples": "node ./spec/ExamplesExecutor.js Examples", - "test:auth_example": "node ./spec/ExamplesExecutor.js AuthExample" - }, - "devDependencies": { - "jasmine": "3.6.1", - "jasmine-expect": "4.0.0", - "jasmine-reporters": "2.1.1" - } -} - diff --git a/modules/platforms/nodejs/spec/ExamplesExecutor.js b/modules/platforms/nodejs/spec/ExamplesExecutor.js deleted file mode 100644 index c02cf66c31eed..0000000000000 --- a/modules/platforms/nodejs/spec/ExamplesExecutor.js +++ /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. - */ - -const Jasmine = require('jasmine'); - -const jasmine = new Jasmine(); -jasmine.loadConfig({ - 'spec_dir': 'spec', - 'spec_files': [ - `examples/${process.argv[2]}.spec.js` - ], - "random": false -}); -jasmine.execute(); \ No newline at end of file diff --git a/modules/platforms/nodejs/spec/TestingHelper.js b/modules/platforms/nodejs/spec/TestingHelper.js deleted file mode 100644 index 25465bb40b96e..0000000000000 --- a/modules/platforms/nodejs/spec/TestingHelper.js +++ /dev/null @@ -1,391 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -'use strict'; - -require('jasmine-expect'); -const JasmineReporters = require('jasmine-reporters'); - -const Util = require('util'); -const exec = require('child_process').exec; -const config = require('./config'); -const IgniteClient = require('apache-ignite-client'); -const IgniteClientConfiguration = IgniteClient.IgniteClientConfiguration; -const Errors = IgniteClient.Errors; -const EnumItem = IgniteClient.EnumItem; -const Timestamp = IgniteClient.Timestamp; -const Decimal = IgniteClient.Decimal; -const BinaryObject = IgniteClient.BinaryObject; -const ObjectType = IgniteClient.ObjectType; - -const TIMEOUT_MS = 60000; - -jasmine.getEnv().addReporter(new JasmineReporters.TeamCityReporter()); - -const dateComparator = (date1, date2) => { return !date1 && !date2 || date1.value === date2.value; }; -const floatComparator = (date1, date2) => { return Math.abs(date1 - date2) < 0.00001; }; -const defaultComparator = (value1, value2) => { return value1 === value2; }; -const enumComparator = (value1, value2) => { - return value1.getTypeId() === value2.getTypeId() && - value1.getOrdinal() === value2.getOrdinal(); }; -const decimalComparator = (value1, value2) => { - return value1 === null && value2 === null || - value1.equals(value2); -}; -const timestampComparator = (value1, value2) => { - return value1 === null && value2 === null || - dateComparator(value1.getTime(), value2.getTime()) && - value1.getNanos() === value2.getNanos(); }; - -const numericValueModificator = (data) => { return data > 0 ? data - 10 : data + 10; }; -const charValueModificator = (data) => { return String.fromCharCode(data.charCodeAt(0) + 5); }; -const booleanValueModificator = (data) => { return !data; }; -const stringValueModificator = (data) => { return data + 'xxx'; }; -const dateValueModificator = (data) => { return new Date(data.getTime() + 12345); }; -const UUIDValueModificator = (data) => { return data.reverse(); }; -const enumValueModificator = (data) => { return new EnumItem(data.getTypeId(), data.getOrdinal() + 1); }; -const decimalValueModificator = (data) => { return data.add(12345); }; -const timestampValueModificator = (data) => { return new Timestamp(new Date(data.getTime() + 12345), data.getNanos() + 123); }; - -const primitiveValues = { - [ObjectType.PRIMITIVE_TYPE.BYTE] : { - values : [-128, 0, 127], - isMapKey : true, - modificator : numericValueModificator - }, - [ObjectType.PRIMITIVE_TYPE.SHORT] : { - values : [-32768, 0, 32767], - isMapKey : true, - modificator : numericValueModificator - }, - [ObjectType.PRIMITIVE_TYPE.INTEGER] : { - values : [12345, 0, -54321], - isMapKey : true, - modificator : numericValueModificator - }, - [ObjectType.PRIMITIVE_TYPE.LONG] : { - values : [12345678912345, 0, -98765432112345], - isMapKey : true, - modificator : numericValueModificator - }, - [ObjectType.PRIMITIVE_TYPE.FLOAT] : { - values : [-1.155, 0, 123e-5], - isMapKey : false, - modificator : numericValueModificator - }, - [ObjectType.PRIMITIVE_TYPE.DOUBLE] : { - values : [-123e5, 0, 0.0001], - typeOptional : true, - isMapKey : false, - modificator : numericValueModificator - }, - [ObjectType.PRIMITIVE_TYPE.CHAR] : { - values : ['a', String.fromCharCode(0x1234)], - isMapKey : true, - modificator : charValueModificator - }, - [ObjectType.PRIMITIVE_TYPE.BOOLEAN] : { - values : [true, false], - isMapKey : true, - typeOptional : true, - modificator : booleanValueModificator - }, - [ObjectType.PRIMITIVE_TYPE.STRING] : { - values : ['abc', ''], - isMapKey : true, - typeOptional : true, - modificator : stringValueModificator - }, - [ObjectType.PRIMITIVE_TYPE.UUID] : { - values : [ - [ 18, 70, 2, 119, 154, 254, 198, 254, 195, 146, 33, 60, 116, 230, 0, 146 ], - [ 141, 77, 31, 194, 127, 36, 184, 255, 192, 4, 118, 57, 253, 209, 111, 147 ] - ], - isMapKey : false, - modificator : UUIDValueModificator - }, - [ObjectType.PRIMITIVE_TYPE.DATE] : { - values : [new Date(), new Date('1995-12-17T03:24:00'), new Date(0)], - typeOptional : true, - isMapKey : false, - modificator : dateValueModificator - }, - // [ObjectType.PRIMITIVE_TYPE.ENUM] : { - // values : [new EnumItem(12345, 7), new EnumItem(0, 0)], - // typeOptional : true, - // isMapKey : false, - // modificator : enumValueModificator - // }, - [ObjectType.PRIMITIVE_TYPE.DECIMAL] : { - values : [new Decimal('123456789.6789345'), new Decimal(0), new Decimal('-98765.4321e15')], - typeOptional : true, - isMapKey : false, - modificator : decimalValueModificator - }, - [ObjectType.PRIMITIVE_TYPE.TIMESTAMP] : { - values : [new Timestamp(new Date().getTime(), 12345), new Timestamp(new Date('1995-12-17T03:24:00').getTime(), 543), new Timestamp(0, 0)], - typeOptional : true, - isMapKey : false, - modificator : timestampValueModificator - }, - [ObjectType.PRIMITIVE_TYPE.TIME] : { - values : [new Date(), new Date('1995-12-17T03:24:00'), new Date(123)], - isMapKey : false, - modificator : dateValueModificator - } -}; - -const arrayValues = { - [ObjectType.PRIMITIVE_TYPE.BYTE_ARRAY] : { elemType : ObjectType.PRIMITIVE_TYPE.BYTE }, - [ObjectType.PRIMITIVE_TYPE.SHORT_ARRAY] : { elemType : ObjectType.PRIMITIVE_TYPE.SHORT }, - [ObjectType.PRIMITIVE_TYPE.INTEGER_ARRAY] : { elemType : ObjectType.PRIMITIVE_TYPE.INTEGER }, - [ObjectType.PRIMITIVE_TYPE.LONG_ARRAY] : { elemType : ObjectType.PRIMITIVE_TYPE.LONG }, - [ObjectType.PRIMITIVE_TYPE.FLOAT_ARRAY] : { elemType : ObjectType.PRIMITIVE_TYPE.FLOAT }, - [ObjectType.PRIMITIVE_TYPE.DOUBLE_ARRAY] : { elemType : ObjectType.PRIMITIVE_TYPE.DOUBLE, typeOptional : true }, - [ObjectType.PRIMITIVE_TYPE.CHAR_ARRAY] : { elemType : ObjectType.PRIMITIVE_TYPE.CHAR }, - [ObjectType.PRIMITIVE_TYPE.BOOLEAN_ARRAY] : { elemType : ObjectType.PRIMITIVE_TYPE.BOOLEAN, typeOptional : true }, - [ObjectType.PRIMITIVE_TYPE.STRING_ARRAY] : { elemType : ObjectType.PRIMITIVE_TYPE.STRING, typeOptional : true }, - [ObjectType.PRIMITIVE_TYPE.UUID_ARRAY] : { elemType : ObjectType.PRIMITIVE_TYPE.UUID }, - [ObjectType.PRIMITIVE_TYPE.DATE_ARRAY] : { elemType : ObjectType.PRIMITIVE_TYPE.DATE, typeOptional : true }, - //[ObjectType.PRIMITIVE_TYPE.ENUM_ARRAY] : { elemType : ObjectType.PRIMITIVE_TYPE.ENUM, typeOptional : true }, - [ObjectType.PRIMITIVE_TYPE.DECIMAL_ARRAY] : { elemType : ObjectType.PRIMITIVE_TYPE.DECIMAL, typeOptional : true }, - [ObjectType.PRIMITIVE_TYPE.TIMESTAMP_ARRAY] : { elemType : ObjectType.PRIMITIVE_TYPE.TIMESTAMP, typeOptional : true }, - [ObjectType.PRIMITIVE_TYPE.TIME_ARRAY] : { elemType : ObjectType.PRIMITIVE_TYPE.TIME } -}; - -// Helper class for testing apache-ignite-client library. -// Contains common methods for testing environment initialization and cleanup. -class TestingHelper { - static get TIMEOUT() { - return TIMEOUT_MS; - } - - static get primitiveValues() { - return primitiveValues; - } - - static get arrayValues() { - return arrayValues; - } - - // Initializes testing environment: creates and starts the library client, sets default jasmine test timeout. - // Should be called from any test suite beforeAll method. - static async init() { - jasmine.DEFAULT_TIMEOUT_INTERVAL = TIMEOUT_MS; - - TestingHelper._igniteClient = new IgniteClient(); - TestingHelper._igniteClient.setDebug(config.debug); - await TestingHelper._igniteClient.connect(new IgniteClientConfiguration(...config.endpoints)); - } - - // Cleans up testing environment. - // Should be called from any test suite afterAll method. - static async cleanUp() { - await TestingHelper.igniteClient.disconnect(); - } - - static get igniteClient() { - return TestingHelper._igniteClient; - } - - static async destroyCache(cacheName, done) { - try { - await TestingHelper.igniteClient.destroyCache(cacheName); - } - catch (err) { - TestingHelper.checkOperationError(err, done); - } - } - - static executeExample(name, outputChecker) { - return new Promise((resolve, reject) => { - exec('node ' + name, (error, stdout, stderr) => { - TestingHelper.logDebug(stdout); - resolve(stdout); - }) - }). - then(output => { - expect(output).not.toMatch('ERROR:'); - expect(output).toMatch('Client is started'); - }); - } - - static checkOperationError(error, done) { - TestingHelper.checkError(error, Errors.OperationError, done) - } - - static checkIllegalArgumentError(error, done) { - TestingHelper.checkError(error, Errors.IgniteClientError, done) - } - - static checkEnumItemSerializationError(error, done) { - if (!(error instanceof Errors.IgniteClientError) || - error.message.indexOf('Enum item can not be serialized') < 0) { - done.fail('unexpected error: ' + error); - } - } - - static checkError(error, errorType, done) { - if (!(error instanceof errorType)) { - done.fail('unexpected error: ' + error); - } - } - - static logDebug(message) { - if (config.debug) { - console.log(message); - } - } - - static printValue(value) { - const val = Util.inspect(value, false, null); - const length = 500; - return val.length > length ? val.substr(0, length) + '...' : val; - } - - static async compare(value1, value2) { - TestingHelper.logDebug(Util.format('compare: %s and %s', TestingHelper.printValue(value1), TestingHelper.printValue(value2))); - if (value1 === undefined || value2 === undefined) { - TestingHelper.logDebug(Util.format('compare: unexpected "undefined" value')); - return false; - } - if (value1 === null && value2 === null) { - return true; - } - if (value1 === null && value2 !== null || value1 !== null && value2 === null) { - return false; - } - if (typeof value1 !== typeof value2) { - TestingHelper.logDebug(Util.format('compare: value types are different: %s and %s', - typeof value1, typeof value2)); - return false; - } - if (typeof value1 === 'number') { - return floatComparator(value1, value2); - } - else if (typeof value1 !== 'object') { - return defaultComparator(value1, value2); - } - else if (value1.constructor.name !== value2.constructor.name && !value2 instanceof BinaryObject) { - TestingHelper.logDebug(Util.format('compare: value types are different: %s and %s', - value1.constructor.name, value2.constructor.name)); - return false; - } - else if (value1 instanceof Date && value2 instanceof Date) { - return dateComparator(value1, value2); - } - else if (value1 instanceof EnumItem && value2 instanceof EnumItem) { - return enumComparator(value1, value2); - } - else if (value1 instanceof Decimal && value2 instanceof Decimal) { - return decimalComparator(value1, value2); - } - else if (value1 instanceof Timestamp && value2 instanceof Timestamp) { - return timestampComparator(value1, value2); - } - else if (value1 instanceof Array && value2 instanceof Array) { - if (value1.length !== value2.length) { - TestingHelper.logDebug(Util.format('compare: array lengths are different')); - return false; - } - for (var i = 0; i < value1.length; i++) { - if (!await TestingHelper.compare(value1[i], value2[i])) { - TestingHelper.logDebug(Util.format('compare: array elements are different: %s, %s', - TestingHelper.printValue(value1[i]), TestingHelper.printValue(value2[i]))); - return false; - } - } - return true; - } - else if (value1 instanceof Map && value2 instanceof Map) { - if (value1.size !== value2.size) { - TestingHelper.logDebug(Util.format('compare: map sizes are different')); - return false; - } - for (var [key, val] of value1) { - if (!value2.has(key)) { - TestingHelper.logDebug(Util.format('compare: maps are different: %s key is absent', TestingHelper.printValue(key))); - return false; - } - if (!(await TestingHelper.compare(val, value2.get(key)))) { - TestingHelper.logDebug(Util.format('compare: map values are different: %s, %s', - TestingHelper.printValue(val), TestingHelper.printValue(value2.get(key)))); - return false; - } - } - return true; - } - else if (value1 instanceof Set && value2 instanceof Set) { - if (value1.size !== value2.size) { - TestingHelper.logDebug(Util.format('compare: set sizes are different')); - return false; - } - const value1Arr = [...value1].sort(); - const value2Arr = [...value2].sort(); - if (!await TestingHelper.compare(value1Arr, value2Arr)) { - TestingHelper.logDebug(Util.format('compare: sets are different: %s and %s', - TestingHelper.printValue(value1Arr), TestingHelper.printValue(value2Arr))); - return false; - } - return true; - } - else if (value2 instanceof BinaryObject) { - if (value1 instanceof BinaryObject) { - if (value1.getTypeName() !== value2.getTypeName()) { - TestingHelper.logDebug(Util.format('compare: binary object type names are different')); - return false; - } - if (!await TestingHelper.compare(value1.getFieldNames(), value2.getFieldNames())) { - TestingHelper.logDebug(Util.format('compare: binary object field names are different')); - return false; - } - for (let fieldName of value1.getFieldNames()) { - if (!value1.hasField(fieldName) || !value2.hasField(fieldName) || - !await TestingHelper.compare(await value1.getField(fieldName), await value1.getField(fieldName))) { - TestingHelper.logDebug(Util.format('compare: binary objects field "%s" values are different', fieldName)); - return false; - } - } - return true; - } - else { - let value; - for (let key of Object.keys(value1)) { - value = await value2.getField(key); - if (!(await TestingHelper.compare(value1[key], value))) { - TestingHelper.logDebug(Util.format('compare: binary object values for key %s are different: %s and %s', - TestingHelper.printValue(key), TestingHelper.printValue(value1[key]), TestingHelper.printValue(value))); - return false; - } - } - return true; - } - } - else { - for (let key of Object.keys(value1)) { - if (!(await TestingHelper.compare(value1[key], value2[key]))) { - TestingHelper.logDebug(Util.format('compare: object values for key %s are different: %s and %s', - TestingHelper.printValue(key), TestingHelper.printValue(value1[key]), TestingHelper.printValue(value2[key]))); - return false; - } - } - return true; - } - } -} - -module.exports = TestingHelper; diff --git a/modules/platforms/nodejs/spec/cache/BinaryObject.spec.js b/modules/platforms/nodejs/spec/cache/BinaryObject.spec.js deleted file mode 100644 index 044251000256c..0000000000000 --- a/modules/platforms/nodejs/spec/cache/BinaryObject.spec.js +++ /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. - */ - -'use strict'; - -require('jasmine-expect'); - -const Util = require('util'); -const TestingHelper = require('../TestingHelper'); -const IgniteClient = require('apache-ignite-client'); -const ObjectType = IgniteClient.ObjectType; -const MapObjectType = IgniteClient.MapObjectType; -const ComplexObjectType = IgniteClient.ComplexObjectType; -const BinaryObject = IgniteClient.BinaryObject; - -const CACHE_NAME = '__test_cache'; - -describe('binary object test suite >', () => { - let igniteClient = null; - const typeName = 'TestClass1'; - const stringValue = 'abc'; - const doubleValue = 123.45; - const boolValue = false; - const intValue = 456; - const dateValue = new Date(); - - beforeAll((done) => { - Promise.resolve(). - then(async () => { - await TestingHelper.init(); - igniteClient = TestingHelper.igniteClient; - await testSuiteCleanup(done); - await igniteClient.getOrCreateCache(CACHE_NAME); - }). - then(done). - catch(error => done.fail(error)); - }, TestingHelper.TIMEOUT); - - afterAll((done) => { - Promise.resolve(). - then(async () => { - await testSuiteCleanup(done); - await TestingHelper.cleanUp(); - }). - then(done). - catch(error => done.fail(error)); - }, TestingHelper.TIMEOUT); - - it('binary objects set get fields', (done) => { - Promise.resolve(). - then(async () => { - const cache = igniteClient.getCache(CACHE_NAME).setKeyType(ObjectType.PRIMITIVE_TYPE.INTEGER); - try { - const obj1 = new BinaryObject(typeName); - obj1.setField('field_double', doubleValue); - obj1.setField('field_string', stringValue); - - await cache.put(2, obj1); - await cache.put(3, obj1); - const obj2 = await cache.get(2); - expect(await TestingHelper.compare(obj1, obj2)).toBe(true); - - const obj3 = await cache.get(3); - obj2.setField('field_double', await obj1.getField('field_double')); - obj2.setField('field_string', await obj1.getField('field_string')); - expect(await TestingHelper.compare(obj1, obj2)).toBe(true); - - obj1.setField('field_double', await obj3.getField('field_double')); - obj1.setField('field_string', await obj3.getField('field_string')); - expect(await TestingHelper.compare(obj1, obj3)).toBe(true); - } - finally { - await cache.removeAll(); - } - }). - then(done). - catch(error => done.fail(error)); - }); - - it('binary object remove field', (done) => { - Promise.resolve(). - then(async () => { - const cache = igniteClient.getCache(CACHE_NAME).setKeyType(ObjectType.PRIMITIVE_TYPE.INTEGER); - try { - const obj1 = new BinaryObject(typeName); - obj1.setField('field_double', doubleValue); - obj1.setField('field_string', stringValue); - obj1.setField('field_bool', boolValue); - expect(obj1.hasField('field_bool')).toBe(true); - expect(await obj1.getField('field_bool')).toBe(boolValue); - - obj1.removeField('field_bool'); - expect(obj1.hasField('field_bool')).toBe(boolValue); - expect(await obj1.getField('field_bool')).toBe(undefined); - - await cache.put(3, obj1); - const obj2 = await cache.get(3); - expect(await TestingHelper.compare(obj1, obj2)).toBe(true); - - obj2.setField('field_bool', boolValue); - expect(obj2.hasField('field_bool')).toBe(true); - expect(await obj2.getField('field_bool')).toBe(boolValue); - - obj2.removeField('field_bool'); - expect(obj2.hasField('field_bool')).toBe(boolValue); - expect(await obj2.getField('field_bool')).toBe(undefined); - - obj2.setField('field_bool', boolValue); - await cache.put(4, obj2); - - obj1.setField('field_bool', boolValue); - await cache.put(5, obj1); - - expect(await TestingHelper.compare(await cache.get(4), await cache.get(5))).toBe(true); - } - finally { - await cache.removeAll(); - } - }). - then(done). - catch(error => done.fail(error)); - }); - - it('binary objects of different schemas', (done) => { - Promise.resolve(). - then(async () => { - const cache = igniteClient.getCache(CACHE_NAME).setKeyType(ObjectType.PRIMITIVE_TYPE.INTEGER); - try { - const obj1 = new BinaryObject(typeName); - obj1.setField('field_int', intValue, ObjectType.PRIMITIVE_TYPE.INTEGER); - obj1.setField('field_string', stringValue); - obj1.setField('field_bool', false); - await cache.put(1, obj1); - - const obj2 = new BinaryObject(typeName); - obj2.setField('field_int', intValue, ObjectType.PRIMITIVE_TYPE.INTEGER); - obj2.setField('field_bool', false); - obj2.setField('field_date', dateValue); - await cache.put(2, obj2); - - const obj3 = await cache.get(1, obj1); - obj3.removeField('field_string'); - const obj4 = await cache.get(2, obj1); - obj4.removeField('field_date'); - expect(await TestingHelper.compare(obj3, obj4)).toBe(true); - - await cache.put(3, obj3); - await cache.put(4, obj4); - expect(await TestingHelper.compare(await cache.get(3), await cache.get(4))).toBe(true); - } - finally { - await cache.removeAll(); - } - }). - then(done). - catch(error => done.fail(error)); - }); - - async function testSuiteCleanup(done) { - await TestingHelper.destroyCache(CACHE_NAME, done); - } -}); diff --git a/modules/platforms/nodejs/spec/cache/Cache.spec.js b/modules/platforms/nodejs/spec/cache/Cache.spec.js deleted file mode 100644 index 713294b5af86e..0000000000000 --- a/modules/platforms/nodejs/spec/cache/Cache.spec.js +++ /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. - */ - -'use strict'; - -require('jasmine-expect'); - -const config = require('../config'); -const TestingHelper = require('../TestingHelper'); -const IgniteClient = require('apache-ignite-client'); -const Errors = IgniteClient.Errors; -const CacheConfiguration = IgniteClient.CacheConfiguration; -const QueryEntity = IgniteClient.QueryEntity; -const QueryField = IgniteClient.QueryField; -const QueryIndex = IgniteClient.QueryIndex; - -const CACHE_NAME = '__test_cache'; -const CACHE_NAME2 = '__test_cache2'; -const CACHE_NAME3 = '__test_cache3'; - -describe('cache configuration operations test suite >', () => { - let igniteClient = null; - - beforeAll((done) => { - Promise.resolve(). - then(async () => { - await TestingHelper.init(); - igniteClient = TestingHelper.igniteClient; - await testSuiteCleanup(done); - }). - then(done). - catch(error => done.fail(error)); - }, TestingHelper.TIMEOUT); - - afterAll((done) => { - Promise.resolve(). - then(async () => { - await testSuiteCleanup(done); - await TestingHelper.cleanUp(); - }). - then(done). - catch(error => done()); - }, TestingHelper.TIMEOUT); - - it('create cache', (done) => { - Promise.resolve(). - then(async () => { - let cache = igniteClient.getCache(CACHE_NAME); - await testCache(cache, false, done); - cache = await igniteClient.createCache(CACHE_NAME); - await testCache(cache, true, done); - cache = igniteClient.getCache(CACHE_NAME); - await testCache(cache, true, done); - await igniteClient.destroyCache(CACHE_NAME); - }). - then(done). - catch(error => done.fail(error)); - }); - - it('create cache twice', (done) => { - Promise.resolve(). - then(async () => { - try { - let cache = await igniteClient.getOrCreateCache(CACHE_NAME); - cache = await igniteClient.createCache(CACHE_NAME); - } - catch (err) { - if (!(err instanceof Errors.OperationError)) { - done.fail('cache successully created twice'); - } - } - finally { - await igniteClient.destroyCache(CACHE_NAME); - } - }). - then(done). - catch(error => done.fail(error)); - }); - - it('get or create cache', (done) => { - Promise.resolve(). - then(async () => { - let cache = igniteClient.getCache(CACHE_NAME2); - await testCache(cache, false, done); - cache = await igniteClient.getOrCreateCache(CACHE_NAME2); - await testCache(cache, true, done); - cache = igniteClient.getCache(CACHE_NAME2); - await testCache(cache, true, done); - await igniteClient.destroyCache(CACHE_NAME2); - }). - then(done). - catch(error => done.fail(error)); - }); - - it('get cache names', (done) => { - Promise.resolve(). - then(async () => { - await igniteClient.getOrCreateCache(CACHE_NAME); - await igniteClient.getOrCreateCache(CACHE_NAME2); - const cacheNames = await igniteClient.cacheNames(); - expect(cacheNames.includes(CACHE_NAME)).toBe(true); - expect(cacheNames.includes(CACHE_NAME2)).toBe(true); - await igniteClient.destroyCache(CACHE_NAME); - await igniteClient.destroyCache(CACHE_NAME2); - }). - then(done). - catch(error => done.fail(error)); - }); - - it('destroy cache', (done) => { - Promise.resolve(). - then(async () => { - let cache = await igniteClient.getOrCreateCache(CACHE_NAME); - await igniteClient.destroyCache(CACHE_NAME); - try { - await igniteClient.destroyCache(CACHE_NAME); - done.fail('cache successfully deleted twice'); - } - catch (err) { - if (!(err instanceof Errors.OperationError)) { - done.fail('unexpected error: ' + err); - } - } - }). - then(done). - catch(error => done.fail(error)); - }); - - it('create cache with configuration', (done) => { - Promise.resolve(). - then(async () => { - const cacheCfg = new CacheConfiguration(). - setQueryEntities( - new QueryEntity(). - setKeyTypeName('INT'). - setValueTypeName('Person'). - setTableName('Person'). - setKeyFieldName('id'). - setValueFieldName('salary'). - setFields([ - new QueryField('id', 'INT'). - setIsKeyField(true), - new QueryField('firstName', 'VARCHAR'). - setIsNotNull(true), - new QueryField('lastName', 'VARCHAR'). - setDefaultValue('lastName'), - new QueryField('salary', 'DOUBLE'). - setPrecision(10). - setScale(10) - ]). - setAliases(new Map([['id', 'id'], ['firstName', 'firstName']])). - setIndexes([ - new QueryIndex('id_idx', QueryIndex.INDEX_TYPE.SORTED). - setName('id_idx'). - setType(QueryIndex.INDEX_TYPE.SORTED). - setInlineSize(10). - setFields(new Map([['id', true], ['firstName', false]])) - ])); - let cache = await igniteClient.createCache(CACHE_NAME3, cacheCfg); - let cfg = await igniteClient.getCacheConfiguration(CACHE_NAME3); - await igniteClient.destroyCache(CACHE_NAME3); - - cache = await igniteClient.getOrCreateCache(CACHE_NAME3, cfg); - let cfg2 = await igniteClient.getCacheConfiguration(CACHE_NAME3); - await igniteClient.destroyCache(CACHE_NAME3); - }). - then(done). - catch(error => done.fail(error)); - }); - - it('create cache with wrong args', (done) => { - Promise.resolve(). - then(async () => { - const method = igniteClient.createCache.bind(igniteClient); - obtainCacheWithWrongName(method, done); - obtainCacheWithWrongConfig(method, done); - }). - then(done). - catch(error => done.fail(error)); - }); - - it('get or create cache with wrong args', (done) => { - Promise.resolve(). - then(async () => { - const method = igniteClient.getOrCreateCache.bind(igniteClient); - obtainCacheWithWrongName(method, done); - obtainCacheWithWrongConfig(method, done); - }). - then(done). - catch(error => done.fail(error)); - }); - - it('get cache with wrong args', (done) => { - Promise.resolve(). - then(async () => { - const method = igniteClient.getCache.bind(igniteClient); - obtainCacheWithWrongName(method, done); - }). - then(done). - catch(error => done.fail(error)); - }); - - async function testSuiteCleanup(done) { - await TestingHelper.destroyCache(CACHE_NAME, done); - await TestingHelper.destroyCache(CACHE_NAME2, done); - await TestingHelper.destroyCache(CACHE_NAME3, done); - } - - async function obtainCacheWithWrongName(method, done) { - const wrongNames = [undefined, null, '']; - for (let name of wrongNames) { - let cache; - try { - cache = await method(name); - } - catch (err) { - TestingHelper.checkIllegalArgumentError(err, done); - } - } - } - - async function obtainCacheWithWrongConfig(method, done) { - const wrongConfigs = ['', new IgniteClient(), new Array()]; - for (let config of wrongConfigs) { - let cache; - try { - cache = await method(CACHE_NAME, config); - } - catch (err) { - TestingHelper.checkIllegalArgumentError(err, done); - } - } - } - - async function testCache(cache, cacheExists, done) { - try { - await cache.put(0, 0); - if (!cacheExists) { - done.fail('operation with absent cache succeeded'); - } - } - catch (err) { - if (!(err instanceof Errors.OperationError)) { - done.fail('unexpected error: ' + err); - } - } - } -}); diff --git a/modules/platforms/nodejs/spec/cache/CacheKeyValueOps.spec.js b/modules/platforms/nodejs/spec/cache/CacheKeyValueOps.spec.js deleted file mode 100644 index d34276ca34a6d..0000000000000 --- a/modules/platforms/nodejs/spec/cache/CacheKeyValueOps.spec.js +++ /dev/null @@ -1,1022 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -'use strict'; - -require('jasmine-expect'); - -const TestingHelper = require('../TestingHelper'); -const IgniteClient = require('apache-ignite-client'); -const ObjectType = IgniteClient.ObjectType; -const CacheClient = IgniteClient.CacheClient; -const CacheEntry = IgniteClient.CacheEntry; -const CacheConfiguration = IgniteClient.CacheConfiguration; - -const CACHE_NAME = '__test_cache'; - -describe('cache key value operations test suite >', () => { - let igniteClient = null; - let cache = null; - - beforeAll((done) => { - Promise.resolve(). - then(async () => { - await TestingHelper.init(); - igniteClient = TestingHelper.igniteClient; - await testSuiteCleanup(done); - await igniteClient.getOrCreateCache(CACHE_NAME); - cache = igniteClient.getCache(CACHE_NAME). - setKeyType(ObjectType.PRIMITIVE_TYPE.INTEGER). - setValueType(ObjectType.PRIMITIVE_TYPE.INTEGER); - }). - then(done). - catch(error => done.fail(error)); - }, TestingHelper.TIMEOUT); - - afterAll((done) => { - Promise.resolve(). - then(async () => { - await testSuiteCleanup(done); - await TestingHelper.cleanUp(); - }). - then(done). - catch(error => done.fail(error)); - }, TestingHelper.TIMEOUT); - - it ('get', (done) => { - Promise.resolve(). - then(async () => { - try { - let value = await cache.get(1); - expect(value).toBe(null); - await cache.put(1, 2); - value = await cache.get(1); - expect(value).toBe(2); - } - finally { - await cache.removeAll(); - } - }). - then(done). - catch(error => done.fail(error)); - }); - - it ('get wrong args', (done) => { - Promise.resolve(). - then(async () => { - try { - const wrongArgs = [null, undefined]; - for (let arg of wrongArgs) { - try { - let value = await cache.get(arg); - done.fail(`cache.get(${arg}) is allowed`); - } - catch (err) { - TestingHelper.checkIllegalArgumentError(err, done); - } - } - } - finally { - await cache.removeAll(); - } - }). - then(done). - catch(error => done.fail(error)); - }); - - it ('getAll', (done) => { - Promise.resolve(). - then(async () => { - try { - for (let i = 0; i < 5; i++) { - await cache.put(i, i * 2); - } - let entries = await cache.getAll([3, 4, 5, 6, 7]); - expect(entries.length).toBe(2, 'get all length is incorrect'); - for (let entry of entries) { - expect(entry.getKey()).toBeWithinRange(3, 4); - expect(entry.getValue()).toBe(entry.getKey() * 2); - } - entries = await cache.getAll([6, 7, 8]); - expect(entries.length).toBe(0, 'get all length is incorrect'); - } - finally { - await cache.removeAll(); - } - }). - then(done). - catch(error => done.fail(error)); - }); - - it ('getAll wrong args', (done) => { - Promise.resolve(). - then(async () => { - try { - const wrongArgs = [null, undefined, 12345, 'abc', []]; - for (let arg of wrongArgs) { - try { - let value = await cache.getAll(arg); - done.fail(`cache.getAll(${arg}) is allowed`); - } - catch (err) { - TestingHelper.checkIllegalArgumentError(err, done); - } - } - } - finally { - await cache.removeAll(); - } - }). - then(done). - catch(error => done.fail(error)); - }); - - it ('put', (done) => { - Promise.resolve(). - then(async () => { - try { - let value = await cache.get(1); - expect(value).toBe(null); - await cache.put(1, 2); - value = await cache.get(1); - expect(value).toBe(2); - await cache.put(1, 4); - value = await cache.get(1); - expect(value).toBe(4); - } - finally { - await cache.removeAll(); - } - }). - then(done). - catch(error => done.fail(error)); - }); - - it ('put wrong args', (done) => { - Promise.resolve(). - then(async () => { - try { - const args = [null, undefined, 1]; - for (let key of args) { - for (let value of args) { - if (key === 1 && value === 1) { - continue; - } - try { - await cache.put(key, value); - done.fail(`cache.put(${key}, ${value}) is allowed`); - } - catch (err) { - TestingHelper.checkIllegalArgumentError(err, done); - } - } - } - } - finally { - await cache.removeAll(); - } - }). - then(done). - catch(error => done.fail(error)); - }); - - it ('putAll', (done) => { - Promise.resolve(). - then(async () => { - try { - const cacheEntries = new Array(); - for (let i = 0; i < 5; i++) { - cacheEntries.push(new CacheEntry(i, i * 2)); - } - await cache.putAll(cacheEntries); - let entries = await cache.getAll([3, 4, 5, 6, 7]); - expect(entries.length).toBe(2, 'get all length is incorrect'); - for (let entry of entries) { - expect(entry.getKey()).toBeWithinRange(3, 4); - expect(entry.getValue()).toBe(entry.getKey() * 2); - } - entries = await cache.getAll([-2, -1, 0, 1, 2, 3, 4, 5, 6, 7]); - expect(entries.length).toBe(5, 'get all length is incorrect'); - for (let entry of entries) { - expect(entry.getKey()).toBeWithinRange(0, 5); - expect(entry.getValue()).toBe(entry.getKey() * 2); - } - entries = await cache.getAll([6, 7, 8]); - expect(entries.length).toBe(0, 'get all length is incorrect'); - } - finally { - await cache.removeAll(); - } - }). - then(done). - catch(error => done.fail(error)); - }); - - it ('putAll wrong args', (done) => { - Promise.resolve(). - then(async () => { - try { - const wrongArgs = [null, undefined, 12345, 'abc', [], [new CacheConfiguration()]]; - for (let arg of wrongArgs) { - try { - let value = await cache.putAll(arg); - done.fail(`cache.putAll(${arg}) is allowed`); - } - catch (err) { - TestingHelper.checkIllegalArgumentError(err, done); - } - } - } - finally { - await cache.removeAll(); - } - }). - then(done). - catch(error => done.fail(error)); - }); - - it ('containsKey', (done) => { - Promise.resolve(). - then(async () => { - try { - let result = await cache.containsKey(1); - expect(result).toBe(false); - await cache.put(1, 2); - result = await cache.containsKey(1); - expect(result).toBe(true); - } - finally { - await cache.removeAll(); - } - }). - then(done). - catch(error => done.fail(error)); - }); - - it ('containsKey wrong args', (done) => { - Promise.resolve(). - then(async () => { - try { - const wrongArgs = [null, undefined]; - for (let arg of wrongArgs) { - try { - let value = await cache.get(arg); - done.fail(`cache.containsKey(${arg}) is allowed`); - } - catch (err) { - TestingHelper.checkIllegalArgumentError(err, done); - } - } - } - finally { - await cache.removeAll(); - } - }). - then(done). - catch(error => done.fail(error)); - }); - - it ('containsKeys', (done) => { - Promise.resolve(). - then(async () => { - try { - let result = await cache.containsKeys([1, 2, 3]); - expect(result).toBe(false); - await cache.putAll([new CacheEntry(1, 2), new CacheEntry(2, 4)]); - result = await cache.containsKeys([1, 2, 3]); - expect(result).toBe(false); - await cache.put(3, 6); - result = await cache.containsKeys([1, 2, 3]); - expect(result).toBe(true); - } - finally { - await cache.removeAll(); - } - }). - then(done). - catch(error => done.fail(error)); - }); - - it ('containsKeys wrong args', (done) => { - Promise.resolve(). - then(async () => { - try { - const wrongArgs = [null, undefined, [], 12345, 'abc']; - for (let arg of wrongArgs) { - try { - let value = await cache.containsKeys(arg); - done.fail(`cache.containsKeys(${arg}) is allowed`); - } - catch (err) { - TestingHelper.checkIllegalArgumentError(err, done); - } - } - } - finally { - await cache.removeAll(); - } - }). - then(done). - catch(error => done.fail(error)); - }); - - it ('getAndPut', (done) => { - Promise.resolve(). - then(async () => { - try { - let value = await cache.getAndPut(1, 2); - expect(value).toBe(null); - value = await cache.getAndPut(1, 4); - expect(value).toBe(2); - await cache.put(1, 6); - value = await cache.getAndPut(1, 8); - expect(value).toBe(6); - value = await cache.get(1); - expect(value).toBe(8); - } - finally { - await cache.removeAll(); - } - }). - then(done). - catch(error => done.fail(error)); - }); - - it ('getAndPut wrong args', (done) => { - Promise.resolve(). - then(async () => { - try { - const args = [null, undefined, 1]; - for (let key of args) { - for (let value of args) { - if (key === 1 && value === 1) { - continue; - } - try { - await cache.getAndPut(key, value); - done.fail(`cache.getAndPut(${key}, ${value}) is allowed`); - } - catch (err) { - TestingHelper.checkIllegalArgumentError(err, done); - } - } - } - } - finally { - await cache.removeAll(); - } - }). - then(done). - catch(error => done.fail(error)); - }); - - it ('getAndReplace', (done) => { - Promise.resolve(). - then(async () => { - try { - let value = await cache.getAndReplace(1, 2); - expect(value).toBe(null); - await cache.put(1, 4); - value = await cache.getAndReplace(1, 6); - expect(value).toBe(4); - value = await cache.get(1); - expect(value).toBe(6); - } - finally { - await cache.removeAll(); - } - }). - then(done). - catch(error => done.fail(error)); - }); - - it ('getAndReplace wrong args', (done) => { - Promise.resolve(). - then(async () => { - try { - const args = [null, undefined, 1]; - for (let key of args) { - for (let value of args) { - if (key === 1 && value === 1) { - continue; - } - try { - await cache.getAndReplace(key, value); - done.fail(`cache.getAndReplace(${key}, ${value}) is allowed`); - } - catch (err) { - TestingHelper.checkIllegalArgumentError(err, done); - } - } - } - } - finally { - await cache.removeAll(); - } - }). - then(done). - catch(error => done.fail(error)); - }); - - it ('getAndRemove', (done) => { - Promise.resolve(). - then(async () => { - try { - let value = await cache.getAndRemove(1); - expect(value).toBe(null); - await cache.put(1, 2); - value = await cache.getAndRemove(1); - expect(value).toBe(2); - value = await cache.get(1); - expect(value).toBe(null); - } - finally { - await cache.removeAll(); - } - }). - then(done). - catch(error => done.fail(error)); - }); - - it ('getAndRemove wrong args', (done) => { - Promise.resolve(). - then(async () => { - try { - const args = [null, undefined]; - for (let key of args) { - try { - await cache.getAndRemove(key); - done.fail(`cache.getAndRemove(${key}) is allowed`); - } - catch (err) { - TestingHelper.checkIllegalArgumentError(err, done); - } - } - } - finally { - await cache.removeAll(); - } - }). - then(done). - catch(error => done.fail(error)); - }); - - it ('putIfAbsent', (done) => { - Promise.resolve(). - then(async () => { - try { - let result = await cache.putIfAbsent(1, 2); - expect(result).toBe(true); - let value = await cache.get(1); - expect(value).toBe(2); - result = await cache.putIfAbsent(1, 4); - expect(result).toBe(false); - value = await cache.get(1); - expect(value).toBe(2); - } - finally { - await cache.removeAll(); - } - }). - then(done). - catch(error => done.fail(error)); - }); - - it ('putIfAbsent wrong args', (done) => { - Promise.resolve(). - then(async () => { - try { - const args = [null, undefined, 1]; - for (let key of args) { - for (let value of args) { - if (key === 1 && value === 1) { - continue; - } - try { - await cache.putIfAbsent(key, value); - done.fail(`cache.putIfAbsent(${key}, ${value}) is allowed`); - } - catch (err) { - TestingHelper.checkIllegalArgumentError(err, done); - } - } - } - } - finally { - await cache.removeAll(); - } - }). - then(done). - catch(error => done.fail(error)); - }); - - it ('getAndPutIfAbsent', (done) => { - Promise.resolve(). - then(async () => { - try { - let value = await cache.getAndPutIfAbsent(1, 2); - expect(value).toBe(null); - value = await cache.get(1); - expect(value).toBe(2); - value = await cache.getAndPutIfAbsent(1, 4); - expect(value).toBe(2); - value = await cache.get(1); - expect(value).toBe(2); - } - finally { - await cache.removeAll(); - } - }). - then(done). - catch(error => done.fail(error)); - }); - - it ('getAndPutIfAbsent wrong args', (done) => { - Promise.resolve(). - then(async () => { - try { - const args = [null, undefined, 1]; - for (let key of args) { - for (let value of args) { - if (key === 1 && value === 1) { - continue; - } - try { - await cache.getAndPutIfAbsent(key, value); - done.fail(`cache.getAndPutIfAbsent(${key}, ${value}) is allowed`); - } - catch (err) { - TestingHelper.checkIllegalArgumentError(err, done); - } - } - } - } - finally { - await cache.removeAll(); - } - }). - then(done). - catch(error => done.fail(error)); - }); - - it ('replace', (done) => { - Promise.resolve(). - then(async () => { - try { - let result = await cache.replace(1, 2); - expect(result).toBe(false); - let value = await cache.get(1); - expect(value).toBe(null); - await cache.put(1, 1); - result = await cache.replace(1, 4); - expect(result).toBe(true); - value = await cache.get(1); - expect(value).toBe(4); - } - finally { - await cache.removeAll(); - } - }). - then(done). - catch(error => done.fail(error)); - }); - - it ('replace wrong args', (done) => { - Promise.resolve(). - then(async () => { - try { - const args = [null, undefined, 1]; - for (let key of args) { - for (let value of args) { - if (key === 1 && value === 1) { - continue; - } - try { - await cache.replace(key, value); - done.fail(`cache.replace(${key}, ${value}) is allowed`); - } - catch (err) { - TestingHelper.checkIllegalArgumentError(err, done); - } - } - } - } - finally { - await cache.removeAll(); - } - }). - then(done). - catch(error => done.fail(error)); - }); - - it ('replaceIfEquals', (done) => { - Promise.resolve(). - then(async () => { - try { - let result = await cache.replaceIfEquals(1, 2, 3); - expect(result).toBe(false); - await cache.put(1, 4); - result = await cache.replaceIfEquals(1, 2, 3); - expect(result).toBe(false); - let value = await cache.get(1); - expect(value).toBe(4); - result = await cache.replaceIfEquals(1, 4, 3); - expect(result).toBe(true); - value = await cache.get(1); - expect(value).toBe(3); - } - finally { - await cache.removeAll(); - } - }). - then(done). - catch(error => done.fail(error)); - }); - - it ('replaceIfEquals wrong args', (done) => { - Promise.resolve(). - then(async () => { - try { - const args = [null, undefined, 1]; - for (let key of args) { - for (let value of args) { - for (let newValue of args) { - if (key === 1 && value === 1 && newValue === 1) { - continue; - } - try { - await cache.replaceIfEquals(key, value, newValue); - done.fail(`cache.replaceIfEquals(${key}, ${value}, ${newValue}) is allowed`); - } - catch (err) { - TestingHelper.checkIllegalArgumentError(err, done); - } - } - } - } - } - finally { - await cache.removeAll(); - } - }). - then(done). - catch(error => done.fail(error)); - }); - - it ('clear', (done) => { - Promise.resolve(). - then(async () => { - try { - await cache.clear(); - let result = await cache.getSize(); - expect(result).toBe(0); - await cache.putAll([new CacheEntry(1, 2), new CacheEntry(2, 4), new CacheEntry(3, 6)]); - result = await cache.getSize(); - expect(result).toBe(3); - await cache.clear(); - result = await cache.getSize(); - expect(result).toBe(0); - let entries = await cache.getAll([1, 2, 3]); - expect(entries.length).toBe(0, 'get all length is incorrect'); - } - finally { - await cache.removeAll(); - } - }). - then(done). - catch(error => done.fail(error)); - }); - - it ('clearKeys', (done) => { - Promise.resolve(). - then(async () => { - try { - await cache.clearKeys([1, 2, 3]); - let result = await cache.getSize(); - expect(result).toBe(0); - await cache.putAll([new CacheEntry(1, 2), new CacheEntry(2, 4), new CacheEntry(3, 6)]); - result = await cache.getSize(); - expect(result).toBe(3); - await cache.clearKeys([1, 2, 7, 8]); - result = await cache.getSize(); - expect(result).toBe(1); - let value = await cache.get(3); - expect(value).toBe(6); - } - finally { - await cache.removeAll(); - } - }). - then(done). - catch(error => done.fail(error)); - }); - - it ('clearKeys wrong args', (done) => { - Promise.resolve(). - then(async () => { - try { - const wrongArgs = [null, undefined, [], 12345, 'abc']; - for (let arg of wrongArgs) { - try { - let value = await cache.clearKeys(arg); - done.fail(`cache.clearKeys(${arg}) is allowed`); - } - catch (err) { - TestingHelper.checkIllegalArgumentError(err, done); - } - } - } - finally { - await cache.removeAll(); - } - }). - then(done). - catch(error => done.fail(error)); - }); - - it ('clearKey', (done) => { - Promise.resolve(). - then(async () => { - try { - await cache.clearKey(1); - let result = await cache.getSize(); - expect(result).toBe(0); - await cache.putAll([new CacheEntry(1, 2), new CacheEntry(2, 4), new CacheEntry(3, 6)]); - result = await cache.getSize(); - expect(result).toBe(3); - await cache.clearKey(1); - result = await cache.getSize(); - expect(result).toBe(2); - let value = await cache.get(2); - expect(value).toBe(4); - value = await cache.get(3); - expect(value).toBe(6); - } - finally { - await cache.removeAll(); - } - }). - then(done). - catch(error => done.fail(error)); - }); - - it ('clearKey wrong args', (done) => { - Promise.resolve(). - then(async () => { - try { - const wrongArgs = [null, undefined]; - for (let arg of wrongArgs) { - try { - let value = await cache.clearKey(arg); - done.fail(`cache.clearKey(${arg}) is allowed`); - } - catch (err) { - TestingHelper.checkIllegalArgumentError(err, done); - } - } - } - finally { - await cache.removeAll(); - } - }). - then(done). - catch(error => done.fail(error)); - }); - - it ('removeKey', (done) => { - Promise.resolve(). - then(async () => { - try { - let result = await cache.removeKey(1); - expect(result).toBe(false); - result = await cache.getSize(); - expect(result).toBe(0); - await cache.putAll([new CacheEntry(1, 2), new CacheEntry(2, 4), new CacheEntry(3, 6)]); - result = await cache.getSize(); - expect(result).toBe(3); - result = await cache.removeKey(1); - expect(result).toBe(true); - result = await cache.removeKey(1); - expect(result).toBe(false); - result = await cache.getSize(); - expect(result).toBe(2); - let value = await cache.get(2); - expect(value).toBe(4); - value = await cache.get(3); - expect(value).toBe(6); - } - finally { - await cache.removeAll(); - } - }). - then(done). - catch(error => done.fail(error)); - }); - - it ('removeKey wrong args', (done) => { - Promise.resolve(). - then(async () => { - try { - const wrongArgs = [null, undefined]; - for (let arg of wrongArgs) { - try { - let value = await cache.removeKey(arg); - done.fail(`cache.removeKey(${arg}) is allowed`); - } - catch (err) { - TestingHelper.checkIllegalArgumentError(err, done); - } - } - } - finally { - await cache.removeAll(); - } - }). - then(done). - catch(error => done.fail(error)); - }); - - it ('removeIfEquals', (done) => { - Promise.resolve(). - then(async () => { - try { - let result = await cache.removeIfEquals(1, 2); - expect(result).toBe(false); - await cache.put(1, 4); - result = await cache.removeIfEquals(1, 2); - expect(result).toBe(false); - result = await cache.removeIfEquals(1, 4); - expect(result).toBe(true); - let value = await cache.get(1); - expect(value).toBe(null); - } - finally { - await cache.removeAll(); - } - }). - then(done). - catch(error => done.fail(error)); - }); - - it ('removeIfEquals wrong args', (done) => { - Promise.resolve(). - then(async () => { - try { - const args = [null, undefined, 1]; - for (let key of args) { - for (let value of args) { - if (key === 1 && value === 1) { - continue; - } - try { - await cache.removeIfEquals(key, value); - done.fail(`cache.removeIfEquals(${key}, ${value}) is allowed`); - } - catch (err) { - TestingHelper.checkIllegalArgumentError(err, done); - } - } - } - } - finally { - await cache.removeAll(); - } - }). - then(done). - catch(error => done.fail(error)); - }); - - it ('removeKeys', (done) => { - Promise.resolve(). - then(async () => { - try { - await cache.removeKeys([1, 2, 3]); - let result = await cache.getSize(); - expect(result).toBe(0); - await cache.putAll([new CacheEntry(1, 2), new CacheEntry(2, 4), new CacheEntry(3, 6)]); - result = await cache.getSize(); - expect(result).toBe(3); - await cache.removeKeys([1, 2, 7, 8]); - result = await cache.getSize(); - expect(result).toBe(1); - let value = await cache.get(3); - expect(value).toBe(6); - } - finally { - await cache.removeAll(); - } - }). - then(done). - catch(error => done.fail(error)); - }); - - it ('removeKeys wrong args', (done) => { - Promise.resolve(). - then(async () => { - try { - const wrongArgs = [null, undefined, [], 12345, 'abc']; - for (let arg of wrongArgs) { - try { - let value = await cache.removeKeys(arg); - done.fail(`cache.removeKeys(${arg}) is allowed`); - } - catch (err) { - TestingHelper.checkIllegalArgumentError(err, done); - } - } - } - finally { - await cache.removeAll(); - } - }). - then(done). - catch(error => done.fail(error)); - }); - - it ('removeAll', (done) => { - Promise.resolve(). - then(async () => { - try { - await cache.removeAll(); - let result = await cache.getSize(); - expect(result).toBe(0); - await cache.putAll([new CacheEntry(1, 2), new CacheEntry(2, 4), new CacheEntry(3, 6)]); - result = await cache.getSize(); - expect(result).toBe(3); - await cache.removeAll(); - result = await cache.getSize(); - expect(result).toBe(0); - let entries = await cache.getAll([1, 2, 3]); - expect(entries.length).toBe(0, 'get all length is incorrect'); - } - finally { - await cache.removeAll(); - } - }). - then(done). - catch(error => done.fail(error)); - }); - - it ('getSize', (done) => { - Promise.resolve(). - then(async () => { - try { - let result = await cache.getSize(); - expect(result).toBe(0); - await cache.putAll([new CacheEntry(1, 2), new CacheEntry(2, 4), new CacheEntry(3, 6)]); - result = await cache.getSize(); - expect(result).toBe(3); - result = await cache.getSize(CacheClient.PEEK_MODE.ALL); - expect(result).toBe(3); - result = await cache.getSize(CacheClient.PEEK_MODE.ALL, CacheClient.PEEK_MODE.ALL); - expect(result).toBe(3); - } - finally { - await cache.removeAll(); - } - }). - then(done). - catch(error => done.fail(error)); - }); - - it ('getSize wrong args', (done) => { - Promise.resolve(). - then(async () => { - try { - const wrongArgs = [null, undefined, [], 12345, 'abc', [12345], ['abc', 'def']]; - for (let arg of wrongArgs) { - try { - let value = await cache.getSize(arg); - done.fail(`cache.getSize(${arg}) is allowed`); - } - catch (err) { - TestingHelper.checkIllegalArgumentError(err, done); - } - } - } - finally { - await cache.removeAll(); - } - }). - then(done). - catch(error => done.fail(error)); - }); - - async function testSuiteCleanup(done) { - await TestingHelper.destroyCache(CACHE_NAME, done); - } -}); diff --git a/modules/platforms/nodejs/spec/cache/CachePutGetDiffTypes.spec.js b/modules/platforms/nodejs/spec/cache/CachePutGetDiffTypes.spec.js deleted file mode 100644 index 5fd370ee76e81..0000000000000 --- a/modules/platforms/nodejs/spec/cache/CachePutGetDiffTypes.spec.js +++ /dev/null @@ -1,686 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -'use strict'; - -require('jasmine-expect'); - -const TestingHelper = require('../TestingHelper'); -const IgniteClient = require('apache-ignite-client'); -const ObjectType = IgniteClient.ObjectType; -const MapObjectType = IgniteClient.MapObjectType; -const CollectionObjectType = IgniteClient.CollectionObjectType; -const ObjectArrayType = IgniteClient.ObjectArrayType; -const ComplexObjectType = IgniteClient.ComplexObjectType; -const EnumItem = IgniteClient.EnumItem; -const Timestamp = IgniteClient.Timestamp; -const Decimal = IgniteClient.Decimal; -const BinaryObject = IgniteClient.BinaryObject; - -const CACHE_NAME = '__test_cache'; - -describe('cache put get test suite >', () => { - let igniteClient = null; - - beforeAll((done) => { - Promise.resolve(). - then(async () => { - await TestingHelper.init(); - igniteClient = TestingHelper.igniteClient; - await testSuiteCleanup(done); - await igniteClient.getOrCreateCache(CACHE_NAME); - }). - then(done). - catch(error => done.fail(error)); - }, TestingHelper.TIMEOUT); - - afterAll((done) => { - Promise.resolve(). - then(async () => { - await testSuiteCleanup(done); - await TestingHelper.cleanUp(); - }). - then(done). - catch(error => done.fail(error)); - }, TestingHelper.TIMEOUT); - - it('put get primitive values of different types', (done) => { - Promise.resolve(). - then(async () => { - for (let type1 of Object.keys(TestingHelper.primitiveValues)) { - type1 = parseInt(type1); - const typeInfo1 = TestingHelper.primitiveValues[type1]; - for (let type2 of Object.keys(TestingHelper.primitiveValues)) { - type2 = parseInt(type2); - const typeInfo2 = TestingHelper.primitiveValues[type2]; - const modificator = typeInfo2.modificator; - for (let value1 of typeInfo1.values) { - for (let value2 of typeInfo2.values) { - await putGetPrimitiveValues(type1, type2, value1, value2, modificator); - if (typeInfo1.typeOptional) { - await putGetPrimitiveValues(null, type2, value1, value2, modificator); - } - if (typeInfo2.typeOptional) { - await putGetPrimitiveValues(type1, null, value1, value2, modificator); - } - } - } - } - } - }). - then(done). - catch(error => done.fail(error)); - }); - - it('put get arrays of different types', (done) => { - Promise.resolve(). - then(async () => { - for (let type of Object.keys(TestingHelper.arrayValues)) { - type = parseInt(type); - const typeInfo = TestingHelper.arrayValues[type]; - const primitiveType = typeInfo.elemType; - const values = TestingHelper.primitiveValues[primitiveType].values; - await putGetArrays(primitiveType, type, values[0], values); - await putGetArrays(primitiveType, type, values[0], []); - if (typeInfo.typeOptional) { - await putGetArrays(primitiveType, null, values[0], values); - } - } - }). - then(done). - catch(error => done.fail(error)); - }); - - it('put get maps of different key/value types', (done) => { - Promise.resolve(). - then(async () => { - for (let type1 of Object.keys(TestingHelper.primitiveValues)) { - type1 = parseInt(type1); - const typeInfo1 = TestingHelper.primitiveValues[type1]; - if (!typeInfo1.isMapKey) { - continue; - } - for (let type2 of Object.keys(TestingHelper.primitiveValues)) { - type2 = parseInt(type2); - const typeInfo2 = TestingHelper.primitiveValues[type2]; - const map = new Map(); - let index2 = 0; - for (let value1 of typeInfo1.values) { - let value2 = typeInfo2.values[index2]; - index2++; - if (index2 >= typeInfo2.values.length) { - index2 = 0; - } - map.set(value1, value2); - } - await putGetMaps( - new MapObjectType(MapObjectType.MAP_SUBTYPE.HASH_MAP, type1, type2), - map); - await putGetMaps( - new MapObjectType( - MapObjectType.MAP_SUBTYPE.LINKED_HASH_MAP, type1, type2), - map); - if (typeInfo1.typeOptional) { - await putGetMaps(new MapObjectType(MapObjectType.MAP_SUBTYPE.HASH_MAP, null, type2), - map); - } - if (typeInfo2.typeOptional) { - await putGetMaps(new MapObjectType(MapObjectType.MAP_SUBTYPE.HASH_MAP, type1, null), - map); - } - } - } - }). - then(done). - catch(error => done.fail(error)); - }); - - it('put get maps with arrays of different types', (done) => { - Promise.resolve(). - then(async () => { - for (let type1 of Object.keys(TestingHelper.primitiveValues)) { - type1 = parseInt(type1); - const typeInfo1 = TestingHelper.primitiveValues[type1]; - if (!typeInfo1.isMapKey) { - continue; - } - for (let type2 of Object.keys(TestingHelper.arrayValues)) { - type2 = parseInt(type2); - const typeInfo2 = TestingHelper.arrayValues[type2]; - const primitiveType2 = typeInfo2.elemType; - const values2 = TestingHelper.primitiveValues[primitiveType2].values; - const map = new Map(); - let index2 = 0; - const arrayValues2 = [values2, null, values2.reverse()]; - for (let value1 of typeInfo1.values) { - map.set(value1, arrayValues2[index2]); - index2++; - if (index2 >= arrayValues2.length) { - index2 = 0; - } - } - await putGetMaps( - new MapObjectType(MapObjectType.MAP_SUBTYPE.HASH_MAP, type1, type2), - map); - await putGetMaps( - new MapObjectType(MapObjectType.MAP_SUBTYPE.LINKED_HASH_MAP, type1, type2), - map); - if (typeInfo1.typeOptional) { - await putGetMaps(new MapObjectType(MapObjectType.MAP_SUBTYPE.HASH_MAP, null, type2), - map); - } - if (typeInfo2.typeOptional) { - await putGetMaps(new MapObjectType(MapObjectType.MAP_SUBTYPE.HASH_MAP, type1, null), - map); - } - } - } - }). - then(done). - catch(error => done.fail(error)); - }); - - it('put get sets of different key/value types', (done) => { - Promise.resolve(). - then(async () => { - for (let type of Object.keys(TestingHelper.primitiveValues)) { - type = parseInt(type); - const typeInfo = TestingHelper.primitiveValues[type]; - const set = new Set(); - for (let value of typeInfo.values) { - set.add(value); - } - await putGetSets( - new CollectionObjectType(CollectionObjectType.COLLECTION_SUBTYPE.USER_SET, type), - set); - await putGetSets( - new CollectionObjectType(CollectionObjectType.COLLECTION_SUBTYPE.HASH_SET, type), - set); - await putGetSets( - new CollectionObjectType(CollectionObjectType.COLLECTION_SUBTYPE.LINKED_HASH_SET, type), - set); - if (typeInfo.typeOptional) { - await putGetSets(new CollectionObjectType(CollectionObjectType.COLLECTION_SUBTYPE.LINKED_HASH_SET), - set); - await putGetSets(null, set); - } - } - }). - then(done). - catch(error => done.fail(error)); - }); - - it('put get lists of different key/value types', (done) => { - Promise.resolve(). - then(async () => { - for (let type of Object.keys(TestingHelper.primitiveValues)) { - type = parseInt(type); - const typeInfo = TestingHelper.primitiveValues[type]; - const list = new Array(); - for (let value of typeInfo.values) { - list.push(value); - } - await putGetLists( - new CollectionObjectType(CollectionObjectType.COLLECTION_SUBTYPE.USER_COL, type), - list); - await putGetLists( - new CollectionObjectType(CollectionObjectType.COLLECTION_SUBTYPE.ARRAY_LIST, type), - list); - await putGetLists( - new CollectionObjectType(CollectionObjectType.COLLECTION_SUBTYPE.LINKED_LIST, type), - list); - if (typeInfo.typeOptional) { - await putGetLists(new CollectionObjectType(CollectionObjectType.COLLECTION_SUBTYPE.ARRAY_LIST), - list); - } - // const singletonList = [typeInfo.values[0]]; - // await putGetLists( - // new CollectionObjectType(CollectionObjectType.COLLECTION_SUBTYPE.SINGLETON_LIST, type), - // singletonList); - } - }). - then(done). - catch(error => done.fail(error)); - }); - - it('put get object array of maps', (done) => { - Promise.resolve(). - then(async () => { - for (let type1 of Object.keys(TestingHelper.primitiveValues)) { - type1 = parseInt(type1); - const typeInfo1 = TestingHelper.primitiveValues[type1]; - if (!typeInfo1.isMapKey) { - continue; - } - for (let type2 of Object.keys(TestingHelper.primitiveValues)) { - type2 = parseInt(type2); - const typeInfo2 = TestingHelper.primitiveValues[type2]; - let map = new Map(); - let index2 = 0; - for (let value1 of typeInfo1.values) { - let value2 = typeInfo2.values[index2]; - index2++; - if (index2 >= typeInfo2.values.length) { - index2 = 0; - } - map.set(value1, value2); - } - const array = new Array(); - for (let i = 0; i < 10; i++) { - map = new Map([...map.entries()].map(([key, value]) => [typeInfo1.modificator(key), typeInfo2.modificator(value)])); - array.push(map); - } - await putGetObjectArrays(new ObjectArrayType(new MapObjectType(MapObjectType.MAP_SUBTYPE.HASH_MAP, type1, type2)), - array); - if (typeInfo1.typeOptional) { - await putGetObjectArrays(new ObjectArrayType(new MapObjectType(MapObjectType.MAP_SUBTYPE.LINKED_HASH_MAP, null, type2)), - array); - } - if (typeInfo2.typeOptional) { - await putGetObjectArrays(new ObjectArrayType(new MapObjectType(MapObjectType.MAP_SUBTYPE.LINKED_HASH_MAP, type1)), - array); - } - if (typeInfo1.typeOptional && typeInfo2.typeOptional) { - await putGetObjectArrays(new ObjectArrayType(), array); - await putGetObjectArrays(null, array); - } - } - } - }). - then(done). - catch(error => done.fail(error)); - }); - - it('put get object array of primitive types', (done) => { - Promise.resolve(). - then(async () => { - for (let type of Object.keys(TestingHelper.primitiveValues)) { - type = parseInt(type); - const typeInfo = TestingHelper.primitiveValues[type]; - let value = typeInfo.values[0]; - const array = new Array(); - for (let i = 0; i < 10; i++) { - value = typeInfo.modificator(value); - array.push(value); - } - await putGetObjectArrays( - new ObjectArrayType(type), - array); - if (typeInfo.typeOptional) { - await putGetObjectArrays(new ObjectArrayType(), array); - } - } - }). - then(done). - catch(error => done.fail(error)); - }); - - it('put get object array of primitive arrays', (done) => { - Promise.resolve(). - then(async () => { - for (let type of Object.keys(TestingHelper.arrayValues)) { - type = parseInt(type); - const typeInfo = TestingHelper.arrayValues[type]; - const primitiveType = typeInfo.elemType; - const primitiveTypeInfo = TestingHelper.primitiveValues[primitiveType]; - let values = primitiveTypeInfo.values; - - const array = new Array(); - for (let i = 0; i < 10; i++) { - values = values.map((value) => primitiveTypeInfo.modificator(value)); - array.push(values); - } - await putGetObjectArrays( - new ObjectArrayType(type), - array); - if (typeInfo.typeOptional) { - await putGetObjectArrays(new ObjectArrayType(), array); - } - } - }). - then(done). - catch(error => done.fail(error)); - }); - - it('put get object array of sets', (done) => { - Promise.resolve(). - then(async () => { - for (let type of Object.keys(TestingHelper.primitiveValues)) { - type = parseInt(type); - const typeInfo = TestingHelper.primitiveValues[type]; - let set = new Set(); - for (let value of typeInfo.values) { - set.add(value); - } - const array = new Array(); - for (let i = 0; i < 10; i++) { - set = new Set([...set].map((value) => typeInfo.modificator(value))); - array.push(set); - } - await putGetObjectArrays( - new ObjectArrayType(new CollectionObjectType(CollectionObjectType.COLLECTION_SUBTYPE.USER_SET, type)), - array); - await putGetObjectArrays( - new ObjectArrayType(new CollectionObjectType(CollectionObjectType.COLLECTION_SUBTYPE.HASH_SET, type)), - array); - await putGetObjectArrays( - new ObjectArrayType(new CollectionObjectType(CollectionObjectType.COLLECTION_SUBTYPE.LINKED_HASH_SET, type)), - array); - if (typeInfo.typeOptional) { - await putGetObjectArrays(new ObjectArrayType(), array); - await putGetObjectArrays(null, array); - } - } - }). - then(done). - catch(error => done.fail(error)); - }); - - it('put get object array of lists', (done) => { - Promise.resolve(). - then(async () => { - for (let type of Object.keys(TestingHelper.primitiveValues)) { - type = parseInt(type); - const typeInfo = TestingHelper.primitiveValues[type]; - let list = new Array(); - for (let value of typeInfo.values) { - list.push(value); - } - const array = new Array(); - for (let i = 0; i < 10; i++) { - list = list.map((value) => typeInfo.modificator(value)); - array.push(list); - } - await putGetObjectArrays( - new ObjectArrayType(new CollectionObjectType(CollectionObjectType.COLLECTION_SUBTYPE.USER_COL, type)), - array); - await putGetObjectArrays( - new ObjectArrayType(new CollectionObjectType(CollectionObjectType.COLLECTION_SUBTYPE.ARRAY_LIST, type)), - array); - await putGetObjectArrays( - new ObjectArrayType(new CollectionObjectType(CollectionObjectType.COLLECTION_SUBTYPE.LINKED_LIST, type)), - array); - if (typeInfo.typeOptional) { - await putGetObjectArrays( - new ObjectArrayType(new CollectionObjectType(CollectionObjectType.COLLECTION_SUBTYPE.ARRAY_LIST)), - array); - } - } - }). - then(done). - catch(error => done.fail(error)); - }); - - it('put get object array of complex objects', (done) => { - Promise.resolve(). - then(async () => { - let object = {}; - for (let type of Object.keys(TestingHelper.primitiveValues)) { - type = parseInt(type); - const typeInfo = TestingHelper.primitiveValues[type]; - object['field' + type] = typeInfo.values[0]; - } - const objectType = new ComplexObjectType(object); - for (let type of Object.keys(TestingHelper.primitiveValues)) { - type = parseInt(type); - objectType.setFieldType('field' + type, type); - } - - let array = new Array(); - for (let i = 0; i < 5; i++) { - for (let field in object) { - const type = parseInt(field.substring(5)); - object[field] = TestingHelper.primitiveValues[type].modificator(object[field]); - } - array.push(object); - } - await putGetObjectArrays( - new ObjectArrayType(objectType), array); - }). - then(done). - catch(error => done.fail(error)); - }); - - it('put get object array of complex objects with default field types', (done) => { - Promise.resolve(). - then(async () => { - let object = {}; - for (let type of Object.keys(TestingHelper.primitiveValues)) { - type = parseInt(type); - const typeInfo = TestingHelper.primitiveValues[type]; - if (typeInfo.typeOptional) { - object['field' + type] = typeInfo.values[0]; - } - } - const objectType = new ComplexObjectType(object, 'tstComplObjectWithDefaultFieldTypes'); - let array = new Array(); - for (let i = 0; i < 5; i++) { - for (let field in object) { - const type = parseInt(field.substring(5)); - object[field] = TestingHelper.primitiveValues[type].modificator(object[field]); - } - array.push(object); - } - await putGetObjectArrays( - new ObjectArrayType(objectType), array); - }). - then(done). - catch(error => done.fail(error)); - }); - - it('put get object array of binary objects', (done) => { - Promise.resolve(). - then(async () => { - let binObject = new BinaryObject('tstBinaryObj'); - for (let type of Object.keys(TestingHelper.primitiveValues)) { - type = parseInt(type); - const typeInfo = TestingHelper.primitiveValues[type]; - binObject.setField('field' + type, typeInfo.values[0], type); - } - let array = new Array(); - for (let i = 0; i < 5; i++) { - for (let field of binObject.getFieldNames()) { - const type = parseInt(field.substring(5)); - binObject.setField( - 'field' + type, - TestingHelper.primitiveValues[type].modificator(await binObject.getField('field' + type)), - type); - } - array.push(binObject); - } - await putGetObjectArrays(new ObjectArrayType(), array); - await putGetObjectArrays(null, array); - }). - then(done). - catch(error => done.fail(error)); - }); - - it('put get object array of object arrays', (done) => { - Promise.resolve(). - then(async () => { - let object = {}; - for (let type of Object.keys(TestingHelper.primitiveValues)) { - type = parseInt(type); - const typeInfo = TestingHelper.primitiveValues[type]; - object['field' + type] = typeInfo.values[0]; - } - const objectType = new ComplexObjectType(object); - for (let type of Object.keys(TestingHelper.primitiveValues)) { - type = parseInt(type); - objectType.setFieldType('field' + type, type); - } - - let array = new Array(); - for (let i = 0; i < 2; i++) { - let innerArray = new Array(); - for (let j = 0; j < 2; j++) { - for (let field in object) { - const type = parseInt(field.substring(5)); - object[field] = TestingHelper.primitiveValues[type].modificator(object[field]); - } - innerArray.push(object); - } - array.push(innerArray); - } - await putGetObjectArrays( - new ObjectArrayType(new ObjectArrayType(objectType)), array); - }). - then(done). - catch(error => done.fail(error)); - }); - - it('put enum items', (done) => { - Promise.resolve(). - then(async () => { - const fakeTypeId = 12345; - const enumItem1 = new EnumItem(fakeTypeId); - enumItem1.setOrdinal(1); - await putEnumItem(enumItem1, null, done); - await putEnumItem(enumItem1, ObjectType.PRIMITIVE_TYPE.ENUM, done); - const enumItem2 = new EnumItem(fakeTypeId); - enumItem2.setName('name'); - await putEnumItem(enumItem2, null, done); - await putEnumItem(enumItem2, ObjectType.PRIMITIVE_TYPE.ENUM, done); - const enumItem3 = new EnumItem(fakeTypeId); - enumItem3.setValue(2); - await putEnumItem(enumItem3, null, done); - await putEnumItem(enumItem3, ObjectType.PRIMITIVE_TYPE.ENUM, done); - }). - then(done). - catch(error => done.fail(error)); - }); - - async function putEnumItem(value, valueType, done) { - const cache = igniteClient.getCache(CACHE_NAME). - setKeyType(null). - setValueType(valueType); - const key = new Date(); - // Enums registration is not supported by the client, therefore put EnumItem must throw IgniteClientError - try { - await cache.put(key, value); - done.fail('put EnumItem must throw IgniteClientError'); - } - catch (err) { - TestingHelper.checkEnumItemSerializationError(err, done); - } - finally { - await cache.removeAll(); - } - } - - async function putGetPrimitiveValues(keyType, valueType, key, value, modificator) { - const cache = await igniteClient.getCache(CACHE_NAME). - setKeyType(keyType). - setValueType(valueType); - try { - await putGetPrimitive(cache, key, keyType, value, valueType); - const newValue = modificator(value); - await putGetPrimitive(cache, key, keyType, newValue, valueType); - } - finally { - await cache.removeAll(); - } - } - - async function putGetPrimitive(cache, key, keyType, value, valueType) { - await cache.put(key, value); - let result = await cache.get(key); - expect(await TestingHelper.compare(value, result)).toBe(true, - `values are not equal: keyType=${keyType}, key=${key}, valueType=${valueType}, put value=${value}, get value=${result}`); - } - - async function putGetArrays(keyType, valueType, key, value) { - const cache = await igniteClient.getCache(CACHE_NAME). - setKeyType(keyType). - setValueType(valueType); - try { - await cache.put(key, value); - let result = await cache.get(key); - await cache.clearKey(key); - expect(result instanceof Array).toBe(true, - `result is not Array: arrayType=${valueType}, result=${result}`); - expect(await TestingHelper.compare(value, result)).toBe(true, - `Arrays are not equal: arrayType=${valueType}, put array=${TestingHelper.printValue(value) - }, get array=${TestingHelper.printValue(result)}`); - } - finally { - await cache.removeAll(); - } - } - - async function putGetMaps(mapType, value) { - const key = new Date(); - const cache = await igniteClient.getCache(CACHE_NAME). - setValueType(mapType); - await cache.put(key, value); - let result = await cache.get(key); - expect(result instanceof Map).toBe(true, - `result is not Map: mapType=${mapType}, result=${result}`); - expect(await TestingHelper.compare(value, result)).toBe(true, - `Maps are not equal: valueType=${mapType._valueType}, put value=${TestingHelper.printValue(value) - }, get value=${TestingHelper.printValue(result)}`); - } - - async function putGetSets(setType, value) { - const key = new Date(); - const cache = await igniteClient.getCache(CACHE_NAME). - setValueType(setType); - await cache.put(key, value); - let result = await cache.get(key); - - expect(result instanceof Set).toBe(true, - `result is not Set: setType=${setType}, result=${result}`); - if (!setType || setType._subType !== CollectionObjectType.COLLECTION_SUBTYPE.LINKED_HASH_SET) { - const valueArr = [...value].sort(); - const resultArr = [...result].sort(); - expect(await TestingHelper.compare(valueArr, resultArr)).toBe(true, `Sets are not equal: valueType=${setType ? setType._elementType : - null}, put value=${TestingHelper.printValue(valueArr)}, get value=${TestingHelper.printValue(resultArr)}`); - } - else { - expect(await TestingHelper.compare(value, result)).toBe(true, `Sets are not equal: valueType=${setType ? setType._elementType : - null}, put value=${TestingHelper.printValue(value)}, get value=${TestingHelper.printValue(result)}`); - } - } - - async function putGetLists(listType, value) { - const key = new Date(); - const cache = await igniteClient.getCache(CACHE_NAME). - setValueType(listType); - await cache.put(key, value); - let result = await cache.get(key); - expect(result instanceof Array).toBe(true, - `result is not Array: listType=${listType}, result=${result}`); - expect(await TestingHelper.compare(value, result)).toBe(true, `Lists are not equal: valueType=${listType ? listType._elementType : - null}, put value=${TestingHelper.printValue(value)}, get value=${TestingHelper.printValue(result)}`); - } - - async function putGetObjectArrays(arrayType, value) { - const key = new Date(); - const cache = await igniteClient.getCache(CACHE_NAME). - setValueType(arrayType); - await cache.put(key, value); - let result = await cache.get(key); - expect(result instanceof Array).toBe(true, - `result is not Array: arrayType=${arrayType}, result=${result}`); - expect(await TestingHelper.compare(value, result)).toBe(true, `Arrays are not equal: valueType=${arrayType ? arrayType._elementType : - null}, put value=${TestingHelper.printValue(value)}, get value=${TestingHelper.printValue(result)}`); - } - - async function testSuiteCleanup(done) { - await TestingHelper.destroyCache(CACHE_NAME, done); - } -}); diff --git a/modules/platforms/nodejs/spec/cache/ComplexObject.spec.js b/modules/platforms/nodejs/spec/cache/ComplexObject.spec.js deleted file mode 100644 index 9cc8115e76363..0000000000000 --- a/modules/platforms/nodejs/spec/cache/ComplexObject.spec.js +++ /dev/null @@ -1,540 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -'use strict'; - -require('jasmine-expect'); - -const Util = require('util'); -const TestingHelper = require('../TestingHelper'); -const IgniteClient = require('apache-ignite-client'); -const ObjectType = IgniteClient.ObjectType; -const MapObjectType = IgniteClient.MapObjectType; -const ComplexObjectType = IgniteClient.ComplexObjectType; -const BinaryObject = IgniteClient.BinaryObject; - -const CACHE_NAME = '__test_cache'; -const ONE_BYTE_MAX_OFFSET = 0x100 - 1; -const TWO_BYTES_MAX_OFFSET = 0x10000 - 1; -const COMPLEX_OBJECT_HEADER_LENGTH = 24; - -class Class1 { - constructor() { - this.field_1_1 = null; - this.field_1_2 = new Class2(); - this.field_1_3 = null; - } -} - -class SubClass1 extends Class1 { - constructor() { - super(); - this.field_1_4 = null; - this.field_1_5 = new Class3(); - this.field_1_6 = null; - this.field_1_7 = null; - this.field_1_8 = null; - } -} - -class Class2 { - constructor() { - this.field_2_1 = null; - this.field_2_2 = null; - } -} - -class Class3 { - constructor() { - this.field_3_1 = null; - this.field_3_2 = null; - } -} - -describe('complex object test suite >', () => { - let igniteClient = null; - - beforeAll((done) => { - Promise.resolve(). - then(async () => { - await TestingHelper.init(); - igniteClient = TestingHelper.igniteClient; - await testSuiteCleanup(done); - await igniteClient.getOrCreateCache(CACHE_NAME); - }). - then(done). - catch(error => done.fail(error)); - }, TestingHelper.TIMEOUT); - - afterAll((done) => { - Promise.resolve(). - then(async () => { - await testSuiteCleanup(done); - await TestingHelper.cleanUp(); - }). - then(done). - catch(error => done.fail(error)); - }, TestingHelper.TIMEOUT); - - it('put get complex objects', (done) => { - Promise.resolve(). - then(async () => { - const value1 = new Class1(); - value1.field_1_1 = getPrimitiveValue(ObjectType.PRIMITIVE_TYPE.BYTE); - value1.field_1_2.field_2_1 = getPrimitiveValue(ObjectType.PRIMITIVE_TYPE.SHORT); - value1.field_1_2.field_2_2 = getPrimitiveValue(ObjectType.PRIMITIVE_TYPE.INTEGER); - value1.field_1_3 = getPrimitiveValue(ObjectType.PRIMITIVE_TYPE.LONG); - - const valueType1 = new ComplexObjectType(new Class1()). - setFieldType('field_1_1', ObjectType.PRIMITIVE_TYPE.BYTE). - setFieldType('field_1_2', new ComplexObjectType(new Class2(), 'Class2ShortInteger'). - setFieldType('field_2_1', ObjectType.PRIMITIVE_TYPE.SHORT). - setFieldType('field_2_2', ObjectType.PRIMITIVE_TYPE.INTEGER)). - setFieldType('field_1_3', ObjectType.PRIMITIVE_TYPE.LONG); - - const value2 = new SubClass1(); - value2.field_1_1 = getPrimitiveValue(ObjectType.PRIMITIVE_TYPE.FLOAT); - value2.field_1_2.field_2_1 = getPrimitiveValue(ObjectType.PRIMITIVE_TYPE.DOUBLE); - value2.field_1_2.field_2_2 = getPrimitiveValue(ObjectType.PRIMITIVE_TYPE.CHAR); - value2.field_1_3 = getPrimitiveValue(ObjectType.PRIMITIVE_TYPE.BOOLEAN); - value2.field_1_4 = getPrimitiveValue(ObjectType.PRIMITIVE_TYPE.STRING); - value2.field_1_5.field_3_1 = getPrimitiveValue(ObjectType.PRIMITIVE_TYPE.DATE); - value2.field_1_5.field_3_2 = getPrimitiveValue(ObjectType.PRIMITIVE_TYPE.UUID); - value2.field_1_6 = getPrimitiveValue(ObjectType.PRIMITIVE_TYPE.DECIMAL); - value2.field_1_7 = getPrimitiveValue(ObjectType.PRIMITIVE_TYPE.TIMESTAMP); - value2.field_1_8 = getPrimitiveValue(ObjectType.PRIMITIVE_TYPE.TIME); - - const valueType2 = new ComplexObjectType(new SubClass1()). - setFieldType('field_1_1', ObjectType.PRIMITIVE_TYPE.FLOAT). - setFieldType('field_1_2', new ComplexObjectType(new Class2(), 'Class2DoubleChar'). - setFieldType('field_2_1', ObjectType.PRIMITIVE_TYPE.DOUBLE). - setFieldType('field_2_2', ObjectType.PRIMITIVE_TYPE.CHAR)). - setFieldType('field_1_3', ObjectType.PRIMITIVE_TYPE.BOOLEAN). - setFieldType('field_1_4', ObjectType.PRIMITIVE_TYPE.STRING). - setFieldType('field_1_5', new ComplexObjectType(new Class3()). - setFieldType('field_3_1', ObjectType.PRIMITIVE_TYPE.DATE). - setFieldType('field_3_2', ObjectType.PRIMITIVE_TYPE.UUID)). - setFieldType('field_1_6', ObjectType.PRIMITIVE_TYPE.DECIMAL). - setFieldType('field_1_7', ObjectType.PRIMITIVE_TYPE.TIMESTAMP). - setFieldType('field_1_8', ObjectType.PRIMITIVE_TYPE.TIME); - - await putGetComplexObjectsWithDifferentTypes( - value1, value2, valueType1, valueType2, Class1, SubClass1); - }). - then(done). - catch(error => done.fail(error)); - }); - - it('put get unnamed complex objects', (done) => { - Promise.resolve(). - then(async () => { - const value1 = {}; - value1.field_1_1 = getPrimitiveValue(ObjectType.PRIMITIVE_TYPE.BYTE); - value1.field_1_2 = {}; - value1.field_1_2.field_2_1 = getPrimitiveValue(ObjectType.PRIMITIVE_TYPE.SHORT); - value1.field_1_2.field_2_2 = getPrimitiveValue(ObjectType.PRIMITIVE_TYPE.INTEGER); - value1.field_1_3 = getPrimitiveValue(ObjectType.PRIMITIVE_TYPE.LONG); - - const valueType1 = new ComplexObjectType(value1, 'ObjectWithByteObjLong'). - setFieldType('field_1_1', ObjectType.PRIMITIVE_TYPE.BYTE). - setFieldType('field_1_2', new ComplexObjectType(value1.field_1_2, 'ObjectWithShortInteger'). - setFieldType('field_2_1', ObjectType.PRIMITIVE_TYPE.SHORT). - setFieldType('field_2_2', ObjectType.PRIMITIVE_TYPE.INTEGER)). - setFieldType('field_1_3', ObjectType.PRIMITIVE_TYPE.LONG); - - const value2 = {}; - value2.field_1_1 = getPrimitiveValue(ObjectType.PRIMITIVE_TYPE.FLOAT); - value2.field_1_2 = {}; - value2.field_1_2.field_2_1 = getPrimitiveValue(ObjectType.PRIMITIVE_TYPE.DOUBLE); - value2.field_1_2.field_2_2 = {}; - value2.field_1_2.field_2_2.field_3_1 = getPrimitiveValue(ObjectType.PRIMITIVE_TYPE.CHAR); - value2.field_1_2.field_2_2.field_3_2 = getPrimitiveValue(ObjectType.PRIMITIVE_TYPE.BOOLEAN); - value2.field_1_3 = getPrimitiveValue(ObjectType.PRIMITIVE_TYPE.STRING); - value2.field_1_4 = getPrimitiveValue(ObjectType.PRIMITIVE_TYPE.DATE); - - const valueType2 = new ComplexObjectType(value2, 'ObjectWithFloatObjStringDate'). - setFieldType('field_1_1', ObjectType.PRIMITIVE_TYPE.FLOAT). - setFieldType('field_1_2', new ComplexObjectType(value2.field_1_2, 'ObjectWithDoubleObj'). - setFieldType('field_2_1', ObjectType.PRIMITIVE_TYPE.DOUBLE). - setFieldType('field_2_2', new ComplexObjectType(value2.field_1_2.field_2_2, 'ObjectWithCharBoolean'). - setFieldType('field_3_1', ObjectType.PRIMITIVE_TYPE.CHAR). - setFieldType('field_3_2', ObjectType.PRIMITIVE_TYPE.BOOLEAN))). - setFieldType('field_1_3', ObjectType.PRIMITIVE_TYPE.STRING). - setFieldType('field_1_4', ObjectType.PRIMITIVE_TYPE.DATE); - - await putGetComplexObjects(value1, value2, - valueType1, valueType2, value2); - - await putGetComplexObjects({}, {}, - new ComplexObjectType({}), new ComplexObjectType({}), {}); - - let binaryKey = await BinaryObject.fromObject(value1, valueType1); - let binaryValue = await BinaryObject.fromObject(value2, valueType2); - await putGetComplexObjects(binaryKey, binaryValue, - null, null, value2); - - binaryKey = await BinaryObject.fromObject({}); - binaryValue = await BinaryObject.fromObject({}); - await putGetComplexObjects(binaryKey, binaryValue, - null, null, {}); - }). - then(done). - catch(error => done.fail(error)); - }); - - it('put get complex objects with arrays', (done) => { - Promise.resolve(). - then(async () => { - const value1 = new Class1(); - value1.field_1_1 = getArrayValues(ObjectType.PRIMITIVE_TYPE.BYTE_ARRAY); - value1.field_1_2.field_2_1 = getArrayValues(ObjectType.PRIMITIVE_TYPE.SHORT_ARRAY); - value1.field_1_2.field_2_2 = getArrayValues(ObjectType.PRIMITIVE_TYPE.INTEGER_ARRAY); - value1.field_1_3 = getArrayValues(ObjectType.PRIMITIVE_TYPE.LONG_ARRAY); - - const valueType1 = new ComplexObjectType(new Class1(), 'Class1WithArrays'). - setFieldType('field_1_1', ObjectType.PRIMITIVE_TYPE.BYTE_ARRAY). - setFieldType('field_1_2', new ComplexObjectType(new Class2(), 'Class2WithShortIntegerArrays'). - setFieldType('field_2_1', ObjectType.PRIMITIVE_TYPE.SHORT_ARRAY). - setFieldType('field_2_2', ObjectType.PRIMITIVE_TYPE.INTEGER_ARRAY)). - setFieldType('field_1_3', ObjectType.PRIMITIVE_TYPE.LONG_ARRAY); - - const value2 = new SubClass1(); - value2.field_1_1 = getArrayValues(ObjectType.PRIMITIVE_TYPE.FLOAT_ARRAY); - value2.field_1_2.field_2_1 = getArrayValues(ObjectType.PRIMITIVE_TYPE.DOUBLE_ARRAY); - value2.field_1_2.field_2_2 = getArrayValues(ObjectType.PRIMITIVE_TYPE.CHAR_ARRAY); - value2.field_1_3 = getArrayValues(ObjectType.PRIMITIVE_TYPE.BOOLEAN_ARRAY); - value2.field_1_4 = getArrayValues(ObjectType.PRIMITIVE_TYPE.STRING_ARRAY); - value2.field_1_5.field_3_1 = getArrayValues(ObjectType.PRIMITIVE_TYPE.DATE_ARRAY); - value2.field_1_5.field_3_2 = getArrayValues(ObjectType.PRIMITIVE_TYPE.UUID_ARRAY); - value2.field_1_6 = getArrayValues(ObjectType.PRIMITIVE_TYPE.DECIMAL_ARRAY); - value2.field_1_7 = getArrayValues(ObjectType.PRIMITIVE_TYPE.TIMESTAMP_ARRAY); - value2.field_1_8 = getArrayValues(ObjectType.PRIMITIVE_TYPE.TIME_ARRAY); - - const valueType2 = new ComplexObjectType(new SubClass1(), 'SubClass1WithArrays'). - setFieldType('field_1_1', ObjectType.PRIMITIVE_TYPE.FLOAT_ARRAY). - setFieldType('field_1_2', new ComplexObjectType(new Class2(), 'Class2WithDoubleCharArrays'). - setFieldType('field_2_1', ObjectType.PRIMITIVE_TYPE.DOUBLE_ARRAY). - setFieldType('field_2_2', ObjectType.PRIMITIVE_TYPE.CHAR_ARRAY)). - setFieldType('field_1_3', ObjectType.PRIMITIVE_TYPE.BOOLEAN_ARRAY). - setFieldType('field_1_4', ObjectType.PRIMITIVE_TYPE.STRING_ARRAY). - setFieldType('field_1_5', new ComplexObjectType(new Class3(), 'Class3WithArrays'). - setFieldType('field_3_1', ObjectType.PRIMITIVE_TYPE.DATE_ARRAY). - setFieldType('field_3_2', ObjectType.PRIMITIVE_TYPE.UUID_ARRAY)). - setFieldType('field_1_6', ObjectType.PRIMITIVE_TYPE.DECIMAL_ARRAY). - setFieldType('field_1_7', ObjectType.PRIMITIVE_TYPE.TIMESTAMP_ARRAY). - setFieldType('field_1_8', ObjectType.PRIMITIVE_TYPE.TIME_ARRAY); - - await putGetComplexObjectsWithDifferentTypes( - value1, value2, valueType1, valueType2, Class1, SubClass1, true); - }). - then(done). - catch(error => done.fail(error)); - }); - - it('put get complex objects with maps', (done) => { - Promise.resolve(). - then(async () => { - const value1 = new Class1(); - value1.field_1_1 = getMapValue(ObjectType.PRIMITIVE_TYPE.BYTE); - value1.field_1_2.field_2_1 = getMapValue(ObjectType.PRIMITIVE_TYPE.SHORT); - value1.field_1_2.field_2_2 = getMapValue(ObjectType.PRIMITIVE_TYPE.INTEGER); - value1.field_1_3 = getMapValue(ObjectType.PRIMITIVE_TYPE.LONG); - - const valueType1 = new ComplexObjectType(new Class1(), 'Class1WithMaps'). - setFieldType('field_1_1', new MapObjectType( - MapObjectType.MAP_SUBTYPE.HASH_MAP, ObjectType.PRIMITIVE_TYPE.BYTE, ObjectType.PRIMITIVE_TYPE.BYTE)). - setFieldType('field_1_2', new ComplexObjectType(new Class2(), 'Class2WithShortIntegerMaps'). - setFieldType('field_2_1', new MapObjectType( - MapObjectType.MAP_SUBTYPE.HASH_MAP, ObjectType.PRIMITIVE_TYPE.SHORT, ObjectType.PRIMITIVE_TYPE.SHORT)). - setFieldType('field_2_2', new MapObjectType( - MapObjectType.MAP_SUBTYPE.HASH_MAP, ObjectType.PRIMITIVE_TYPE.INTEGER, ObjectType.PRIMITIVE_TYPE.INTEGER))). - setFieldType('field_1_3', new MapObjectType( - MapObjectType.MAP_SUBTYPE.HASH_MAP, ObjectType.PRIMITIVE_TYPE.LONG, ObjectType.PRIMITIVE_TYPE.LONG)); - - const value2 = new SubClass1(); - value2.field_1_1 = getMapValue(ObjectType.PRIMITIVE_TYPE.FLOAT); - value2.field_1_2.field_2_1 = getMapValue(ObjectType.PRIMITIVE_TYPE.DOUBLE); - value2.field_1_2.field_2_2 = getMapValue(ObjectType.PRIMITIVE_TYPE.CHAR); - value2.field_1_3 = getMapValue(ObjectType.PRIMITIVE_TYPE.BOOLEAN); - value2.field_1_4 = getMapValue(ObjectType.PRIMITIVE_TYPE.STRING); - value2.field_1_5.field_3_1 = getMapValue(ObjectType.PRIMITIVE_TYPE.DATE); - value2.field_1_5.field_3_2 = getMapValue(ObjectType.PRIMITIVE_TYPE.UUID); - value2.field_1_6 = getMapValue(ObjectType.PRIMITIVE_TYPE.DECIMAL); - value2.field_1_7 = getMapValue(ObjectType.PRIMITIVE_TYPE.TIMESTAMP); - value2.field_1_8 = getMapValue(ObjectType.PRIMITIVE_TYPE.TIME); - - const valueType2 = new ComplexObjectType(new SubClass1(), 'SubClass1WithMaps'). - setFieldType('field_1_1', new MapObjectType( - MapObjectType.MAP_SUBTYPE.HASH_MAP, ObjectType.PRIMITIVE_TYPE.STRING, ObjectType.PRIMITIVE_TYPE.FLOAT)). - setFieldType('field_1_2', new ComplexObjectType(new Class2(), 'Class2WithDoubleCharMaps'). - setFieldType('field_2_1', new MapObjectType( - MapObjectType.MAP_SUBTYPE.HASH_MAP, ObjectType.PRIMITIVE_TYPE.STRING, ObjectType.PRIMITIVE_TYPE.DOUBLE)). - setFieldType('field_2_2', new MapObjectType( - MapObjectType.MAP_SUBTYPE.HASH_MAP, ObjectType.PRIMITIVE_TYPE.CHAR, ObjectType.PRIMITIVE_TYPE.CHAR))). - setFieldType('field_1_3', new MapObjectType( - MapObjectType.MAP_SUBTYPE.HASH_MAP, ObjectType.PRIMITIVE_TYPE.BOOLEAN, ObjectType.PRIMITIVE_TYPE.BOOLEAN)). - setFieldType('field_1_4', new MapObjectType( - MapObjectType.MAP_SUBTYPE.HASH_MAP, ObjectType.PRIMITIVE_TYPE.STRING, ObjectType.PRIMITIVE_TYPE.STRING)). - setFieldType('field_1_5', new ComplexObjectType(new Class3(), 'Class3WithMaps'). - setFieldType('field_3_1', new MapObjectType( - MapObjectType.MAP_SUBTYPE.HASH_MAP, ObjectType.PRIMITIVE_TYPE.STRING, ObjectType.PRIMITIVE_TYPE.DATE)). - setFieldType('field_3_2', new MapObjectType( - MapObjectType.MAP_SUBTYPE.HASH_MAP, ObjectType.PRIMITIVE_TYPE.STRING, ObjectType.PRIMITIVE_TYPE.UUID))). - setFieldType('field_1_6', new MapObjectType( - MapObjectType.MAP_SUBTYPE.HASH_MAP, ObjectType.PRIMITIVE_TYPE.STRING, ObjectType.PRIMITIVE_TYPE.DECIMAL)). - setFieldType('field_1_7', new MapObjectType( - MapObjectType.MAP_SUBTYPE.HASH_MAP, ObjectType.PRIMITIVE_TYPE.STRING, ObjectType.PRIMITIVE_TYPE.TIMESTAMP)). - setFieldType('field_1_8', new MapObjectType( - MapObjectType.MAP_SUBTYPE.HASH_MAP, ObjectType.PRIMITIVE_TYPE.STRING, ObjectType.PRIMITIVE_TYPE.TIME)); - - await putGetComplexObjectsWithDifferentTypes( - value1, value2, valueType1, valueType2, Class1, SubClass1, true); - }). - then(done). - catch(error => done.fail(error)); - }); - - it('put get binary objects from objects', (done) => { - Promise.resolve(). - then(async () => { - const valueType = new ComplexObjectType(new Class1(), 'Class1WithStringObjStringArray'). - setFieldType('field_1_1', ObjectType.PRIMITIVE_TYPE.STRING). - setFieldType('field_1_2', new ComplexObjectType(new Class2(), 'Class2WithShortBoolean'). - setFieldType('field_2_1', ObjectType.PRIMITIVE_TYPE.SHORT). - setFieldType('field_2_2', ObjectType.PRIMITIVE_TYPE.BOOLEAN)). - setFieldType('field_1_3', ObjectType.PRIMITIVE_TYPE.STRING_ARRAY); - await putGetBinaryObjects(valueType); - const defaultValueType = new ComplexObjectType(new Class1(), 'Class1Default'). - setFieldType('field_1_2', new ComplexObjectType(new Class2(), 'Class2Default')); - await putGetBinaryObjects(defaultValueType); - }). - then(done). - catch(error => done.fail(error)); - }); - - it('put get complex objects with one byte offset', (done) => { - Promise.resolve(). - then(async () => { - const key = new Date(); - const valueType = new ComplexObjectType(new Class2(), 'Class2WithStrings'); - const value = new Class2(); - value.field_2_1 = 'x'; - value.field_2_2 = 'y'; - await putGetComplexObjects(key, value, null, valueType, value); - const oneByteMaxLen = getMaxFieldLength(true); - value.field_2_1 = 'x'.repeat(oneByteMaxLen); - value.field_2_2 = 'y'; - await putGetComplexObjects(key, value, null, valueType, value); - }). - then(done). - catch(error => done.fail(error)); - }); - - it('put get complex objects with two bytes offset', (done) => { - Promise.resolve(). - then(async () => { - const key = new Date(); - const valueType = new ComplexObjectType(new Class2(), 'Class2WithStrings'); - const value = new Class2(); - const oneByteMaxLen = getMaxFieldLength(true); - value.field_2_1 = 'x'.repeat(oneByteMaxLen + 1); - value.field_2_2 = 'y'; - await putGetComplexObjects(key, value, null, valueType, value); - const twoBytesMaxLen = getMaxFieldLength(false); - value.field_2_1 = 'x'.repeat(twoBytesMaxLen); - value.field_2_2 = 'y'; - await putGetComplexObjects(key, value, null, valueType, value); - }). - then(done). - catch(error => done.fail(error)); - }); - - it('put get complex objects with four bytes offset', (done) => { - Promise.resolve(). - then(async () => { - const key = new Date(); - const valueType = new ComplexObjectType(new Class2(), 'Class2WithStrings'); - const value = new Class2(); - const twoBytesMaxLen = getMaxFieldLength(false); - value.field_2_1 = 'x'.repeat(twoBytesMaxLen + 1); - value.field_2_2 = 'y'; - await putGetComplexObjects(key, value, null, valueType, value); - value.field_2_1 = 'x'.repeat(twoBytesMaxLen * 2); - value.field_2_2 = 'y'; - await putGetComplexObjects(key, value, null, valueType, value); - }). - then(done). - catch(error => done.fail(error)); - }); - - it('put get complex objects without schema', (done) => { - Promise.resolve(). - then(async () => { - const key = new Date(); - const valueType = new ComplexObjectType({}); - const value = {}; - await putGetComplexObjects(key, value, null, valueType, value); - }). - then(done). - catch(error => done.fail(error)); - }); - - function getMaxFieldLength(oneByte) { - const maxOffset = oneByte ? ONE_BYTE_MAX_OFFSET : TWO_BYTES_MAX_OFFSET; - // max offset - field type code - field type (string) length - complex object header length - return maxOffset - 1 - 4 - COMPLEX_OBJECT_HEADER_LENGTH; - } - - async function testSuiteCleanup(done) { - await TestingHelper.destroyCache(CACHE_NAME, done); - } - - async function putGetComplexObjects(key, value, keyType, valueType, valuePattern) { - const cache = igniteClient.getCache(CACHE_NAME).setKeyType(keyType).setValueType(valueType); - try { - await cache.put(key, value); - const result = await cache.get(key); - expect(await TestingHelper.compare(valuePattern, result)).toBe(true, - `values are not equal: put value=${TestingHelper.printValue(valuePattern)}, get value=${TestingHelper.printValue(result)}`); - } - finally { - await cache.removeAll(); - } - } - - async function binaryObjectEquals(binaryObj, valuePattern, valueType) { - expect(await TestingHelper.compare(valuePattern, binaryObj)).toBe(true, - `binary values are not equal: put value=${TestingHelper.printValue(valuePattern)}, get value=${TestingHelper.printValue(binaryObj)}`); - - let value1, value2; - for (let key of Object.keys(valuePattern)) { - value1 = valuePattern[key]; - value2 = await binaryObj.getField(key, valueType ? valueType._getFieldType(key) : null); - expect(await TestingHelper.compare(value1, value2)).toBe(true, - `values for key ${key} are not equal: put value=${TestingHelper.printValue(value1) - }, get value=${TestingHelper.printValue(value2)}`); - } - - if (valueType) { - const toObject = await binaryObj.toObject(valueType); - expect(await TestingHelper.compare(valuePattern, toObject)).toBe(true, - `values are not equal: put value=${TestingHelper.printValue(valuePattern)}, get value=${TestingHelper.printValue(toObject)}`); - } - } - - async function putGetComplexObjectsWithDifferentTypes( - key, value, keyType, valueType, keyClass, valueClass, isNullable = false) { - await putGetComplexObjects(key, value, keyType, valueType, value); - - if (isNullable) { - await putGetComplexObjects(new keyClass(), new valueClass(), keyType, valueType, new valueClass()); - } - - let binaryKey = await BinaryObject.fromObject(key, keyType); - let binaryValue = await BinaryObject.fromObject(value, valueType); - await putGetComplexObjects(binaryKey, binaryValue, null, null, value); - - if (isNullable) { - binaryKey = await BinaryObject.fromObject(new keyClass(), keyType); - binaryValue = await BinaryObject.fromObject(new valueClass(), valueType); - await putGetComplexObjects(binaryKey, binaryValue, null, null, new valueClass()); - } - } - - async function putGetBinaryObjects(valueType) { - const value1 = new Class1(); - value1.field_1_1 = 'abc'; - value1.field_1_2.field_2_1 = 1234; - value1.field_1_2.field_2_2 = true; - value1.field_1_3 = ['a', 'bb', 'ccc']; - - const value2 = new Class1(); - value2.field_1_1 = 'def'; - value2.field_1_2.field_2_1 = 5432; - value2.field_1_2.field_2_2 = false; - value2.field_1_3 = ['a', 'bb', 'ccc', 'dddd']; - - const value3 = new Class1(); - value3.field_1_1 = 'defdef'; - value3.field_1_2.field_2_1 = 543; - value3.field_1_2.field_2_2 = false; - value3.field_1_3 = ['a', 'bb', 'ccc', 'dddd', 'eeeee']; - - const field_1_2_Type = valueType ? valueType._getFieldType('field_1_2') : null; - - const binaryValue1 = await BinaryObject.fromObject(value1, valueType); - const binaryValue2 = await BinaryObject.fromObject(value2, valueType); - const binaryValue3 = await BinaryObject.fromObject(value3, valueType); - - const cache = igniteClient.getCache(CACHE_NAME); - try { - await cache.put(binaryValue1, binaryValue2); - let result = await cache.get(binaryValue1); - await binaryObjectEquals(result, value2, valueType); - - binaryValue1.setField('field_1_1', 'abcde'); - result = await cache.get(binaryValue1); - expect(result === null).toBe(true); - - binaryValue2.setField('field_1_1', value3.field_1_1); - binaryValue2.setField('field_1_2', value3.field_1_2, field_1_2_Type); - binaryValue2.setField('field_1_3', value3.field_1_3); - await cache.put(binaryValue1, binaryValue2); - result = await cache.get(binaryValue1); - await binaryObjectEquals(result, value3, valueType); - - binaryValue1.setField('field_1_1', 'abc'); - binaryValue1.setField('field_1_3', await binaryValue1.getField('field_1_3')); - result = await cache.get(binaryValue1); - await binaryObjectEquals(result, value2, valueType); - - result = await cache.get(binaryValue1); - await binaryObjectEquals(result, value2, valueType); - - binaryValue3.setField('field_1_1', await result.getField('field_1_1')); - binaryValue3.setField('field_1_2', await result.getField('field_1_2', field_1_2_Type), field_1_2_Type); - binaryValue3.setField('field_1_3', await result.getField('field_1_3')); - await cache.put(binaryValue1, binaryValue3); - result = await cache.get(binaryValue1); - await binaryObjectEquals(result, value2, valueType); - } - finally { - await cache.removeAll(); - } - } - - function getPrimitiveValue(typeCode) { - return TestingHelper.primitiveValues[typeCode].values[0]; - } - - function getArrayValues(typeCode) { - return TestingHelper.primitiveValues[TestingHelper.arrayValues[typeCode].elemType].values; - } - - function getMapValue(typeCode) { - const map = new Map(); - const values = TestingHelper.primitiveValues[typeCode].values; - const length = values.length; - values.forEach((value, index) => { - if (!TestingHelper.primitiveValues[typeCode].isMapKey) { - value = Util.format("%s", value); - } - map.set(value, values[length - index - 1]); - }); - return map; - } -}); diff --git a/modules/platforms/nodejs/spec/cache/UUID.spec.js b/modules/platforms/nodejs/spec/cache/UUID.spec.js deleted file mode 100644 index 1715113770f95..0000000000000 --- a/modules/platforms/nodejs/spec/cache/UUID.spec.js +++ /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. - */ - -'use strict'; - -require('jasmine-expect'); - -const TestingHelper = require('../TestingHelper'); -const IgniteClient = require('apache-ignite-client'); -const CacheConfiguration = IgniteClient.CacheConfiguration; -const SqlFieldsQuery = IgniteClient.SqlFieldsQuery; -const ObjectType = IgniteClient.ObjectType; - -const CACHE_NAME = '__test_cache'; -const TABLE_NAME = '__test_UUID_table'; -const UUID_STRINGS = [ - 'd57babad-7bc1-4c82-9f9c-e72841b92a85', - '5946c0c0-2b76-479d-8694-a2e64a3968da', - 'a521723d-ad5d-46a6-94ad-300f850ef704' -]; - -describe('uuid test suite >', () => { - let igniteClient = null; - - beforeAll((done) => { - Promise.resolve(). - then(async () => { - await TestingHelper.init(); - igniteClient = TestingHelper.igniteClient; - await testSuiteCleanup(done); - await igniteClient.getOrCreateCache(CACHE_NAME, new CacheConfiguration().setSqlSchema('PUBLIC')); - }). - then(done). - catch(error => done.fail(error)); - }, TestingHelper.TIMEOUT); - - afterAll((done) => { - Promise.resolve(). - then(async () => { - await testSuiteCleanup(done); - await TestingHelper.cleanUp(); - }). - then(done). - catch(error => done.fail(error)); - }, TestingHelper.TIMEOUT); - - it('insert byte array and select string to check uuid marshalling', (done) => { - Promise.resolve(). - then(async () => { - const cache = igniteClient.getCache(CACHE_NAME); - const createTable = `CREATE TABLE IF NOT EXISTS ${TABLE_NAME} (id INTEGER PRIMARY KEY, uuid_field UUID)`; - (await cache.query(new SqlFieldsQuery(createTable))).getAll(); - - const insertQuery = new SqlFieldsQuery(`INSERT INTO ${TABLE_NAME} (id, uuid_field) VALUES (?, ?)`); - const dataTypes = [ObjectType.PRIMITIVE_TYPE.INTEGER, ObjectType.PRIMITIVE_TYPE.UUID]; - - let id = 1; - for (let uuidStr of UUID_STRINGS) { - const args = [id++, uuidToBytes(uuidStr)]; - (await cache.query(insertQuery.setArgs(...args).setArgTypes(...dataTypes))).getAll(); - } - - const selectQuery = `SELECT * FROM ${TABLE_NAME} WHERE uuid_field = ?`; - - for (let uuidStr of UUID_STRINGS) { - const cursor = await cache.query(new SqlFieldsQuery(selectQuery).setArgs(uuidStr)); - const rows = await cursor.getAll(); - expect(rows.length).toBe(1); - expect(rows[0][1]).toEqual(uuidToBytes(uuidStr)); - } - }). - then(done). - catch(error => done.fail(error)); - }); - - function uuidToBytes(uuidStr) { - const buf = []; - uuidStr.toLowerCase().replace(/[0-9a-f]{2}/g, function(oct) { - buf.push(parseInt(oct, 16)); - }); - - return buf; - } - - async function testSuiteCleanup(done) { - const cache = await igniteClient.getOrCreateCache(CACHE_NAME, new CacheConfiguration().setSqlSchema('PUBLIC')); - const dropTable = `DROP TABLE IF EXISTS ${TABLE_NAME}`; - (await cache.query(new SqlFieldsQuery(dropTable))).getAll(); - await TestingHelper.destroyCache(CACHE_NAME, done); - } -}); diff --git a/modules/platforms/nodejs/spec/config.js b/modules/platforms/nodejs/spec/config.js deleted file mode 100644 index 747170aae669d..0000000000000 --- a/modules/platforms/nodejs/spec/config.js +++ /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. - */ - -'use strict'; - -exports.endpoints = process.env.APACHE_IGNITE_CLIENT_ENDPOINTS ? - process.env.APACHE_IGNITE_CLIENT_ENDPOINTS.split(',') : []; -exports.debug = process.env.APACHE_IGNITE_CLIENT_DEBUG === 'true' || - process.env.APACHE_IGNITE_CLIENT_DEBUG === '1'; - - -//exports.endpoints = ['127.0.0.1:10800']; -//exports.debug = false; \ No newline at end of file diff --git a/modules/platforms/nodejs/spec/examples/AuthExample.spec.js b/modules/platforms/nodejs/spec/examples/AuthExample.spec.js deleted file mode 100644 index 667a39603ff02..0000000000000 --- a/modules/platforms/nodejs/spec/examples/AuthExample.spec.js +++ /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. - */ - -'use strict'; - -const TestingHelper = require('../TestingHelper'); - -describe('execute auth example >', () => { - beforeAll((done) => { - jasmine.DEFAULT_TIMEOUT_INTERVAL = TestingHelper.TIMEOUT; - done(); - }); - - it('AuthTlsExample', (done) => { - TestingHelper.executeExample('examples/AuthTlsExample.js'). - then(done). - catch(error => done.fail(error)); - }); -}); diff --git a/modules/platforms/nodejs/spec/examples/Examples.spec.js b/modules/platforms/nodejs/spec/examples/Examples.spec.js deleted file mode 100644 index 2ba5f08ec641a..0000000000000 --- a/modules/platforms/nodejs/spec/examples/Examples.spec.js +++ /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. - */ - -'use strict'; - -const TestingHelper = require('../TestingHelper'); - -describe('execute examples >', () => { - beforeAll((done) => { - jasmine.DEFAULT_TIMEOUT_INTERVAL = TestingHelper.TIMEOUT; - done(); - }); - - it('CachePutGetExample', (done) => { - TestingHelper.executeExample('examples/CachePutGetExample.js'). - then(done). - catch(error => done.fail(error)); - }); - - it('SqlExample', (done) => { - TestingHelper.executeExample('examples/SqlExample.js'). - then(done). - catch(error => done.fail(error)); - }); - - it('SqlQueryEntriesExample', (done) => { - TestingHelper.executeExample('examples/SqlQueryEntriesExample.js'). - then(done). - catch(error => done.fail(error)); - }); -}); diff --git a/modules/platforms/nodejs/spec/query/ScanQuery.spec.js b/modules/platforms/nodejs/spec/query/ScanQuery.spec.js deleted file mode 100644 index ab2897396ec0d..0000000000000 --- a/modules/platforms/nodejs/spec/query/ScanQuery.spec.js +++ /dev/null @@ -1,207 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -'use strict'; - -require('jasmine-expect'); - -const config = require('../config'); -const TestingHelper = require('../TestingHelper'); -const IgniteClient = require('apache-ignite-client'); -const Errors = IgniteClient.Errors; -const ScanQuery = IgniteClient.ScanQuery; -const ObjectType = IgniteClient.ObjectType; - -const CACHE_NAME = '__test_cache'; -const ELEMENTS_NUMBER = 10; - -describe('scan query test suite >', () => { - let igniteClient = null; - - beforeAll((done) => { - Promise.resolve(). - then(async () => { - await TestingHelper.init(); - igniteClient = TestingHelper.igniteClient; - await testSuiteCleanup(done); - await igniteClient.getOrCreateCache(CACHE_NAME); - await generateData(done); - }). - then(done). - catch(error => done.fail(error)); - }, TestingHelper.TIMEOUT); - - afterAll((done) => { - Promise.resolve(). - then(async () => { - await testSuiteCleanup(done); - await TestingHelper.cleanUp(); - }). - then(done). - catch(error => done()); - }, TestingHelper.TIMEOUT); - - it('get all', (done) => { - Promise.resolve(). - then(async () => { - let cache = igniteClient.getCache(CACHE_NAME); - const cursor = await cache.query(new ScanQuery()); - const set = new Set(); - for (let cacheEntry of await cursor.getAll()) { - expect(generateValue(cacheEntry.getKey()) === cacheEntry.getValue()).toBe(true); - set.add(cacheEntry.getKey()); - expect(cacheEntry.getKey() >= 0 && cacheEntry.getKey() < ELEMENTS_NUMBER).toBe(true); - } - expect(set.size).toBe(ELEMENTS_NUMBER); - }). - then(done). - catch(error => done.fail(error)); - }); - - it('get all with page size', (done) => { - Promise.resolve(). - then(async () => { - let cache = igniteClient.getCache(CACHE_NAME); - const cursor = await cache.query(new ScanQuery().setPageSize(1)); - const set = new Set(); - for (let cacheEntry of await cursor.getAll()) { - expect(generateValue(cacheEntry.getKey()) === cacheEntry.getValue()).toBe(true); - set.add(cacheEntry.getKey()); - expect(cacheEntry.getKey() >= 0 && cacheEntry.getKey() < ELEMENTS_NUMBER).toBe(true); - } - expect(set.size).toBe(ELEMENTS_NUMBER); - }). - then(done). - catch(error => done.fail(error)); - }); - - it('get value', (done) => { - Promise.resolve(). - then(async () => { - let cache = igniteClient.getCache(CACHE_NAME); - const cursor = await cache.query(new ScanQuery()); - const set = new Set(); - do { - let cacheEntry = await cursor.getValue(); - expect(generateValue(cacheEntry.getKey()) === cacheEntry.getValue()).toBe(true); - set.add(cacheEntry.getKey()); - expect(cacheEntry.getKey() >= 0 && cacheEntry.getKey() < ELEMENTS_NUMBER).toBe(true); - } while (cursor.hasMore()); - expect(set.size).toBe(ELEMENTS_NUMBER); - }). - then(done). - catch(error => done.fail(error)); - }); - - it('get value with page size', (done) => { - Promise.resolve(). - then(async () => { - let cache = igniteClient.getCache(CACHE_NAME); - const cursor = await cache.query(new ScanQuery().setPageSize(2)); - const set = new Set(); - do { - let cacheEntry = await cursor.getValue(); - expect(generateValue(cacheEntry.getKey()) === cacheEntry.getValue()).toBe(true); - set.add(cacheEntry.getKey()); - expect(cacheEntry.getKey() >= 0 && cacheEntry.getKey() < ELEMENTS_NUMBER).toBe(true); - } while (cursor.hasMore()); - expect(set.size).toBe(ELEMENTS_NUMBER); - }). - then(done). - catch(error => done.fail(error)); - }); - - it('close cursor', (done) => { - Promise.resolve(). - then(async () => { - let cache = igniteClient.getCache(CACHE_NAME); - const cursor = await cache.query(new ScanQuery().setPageSize(1)); - await cursor.getValue(); - await cursor.close(); - }). - then(done). - catch(error => done.fail(error)); - }); - - it('close cursor after get all', (done) => { - Promise.resolve(). - then(async () => { - let cache = igniteClient.getCache(CACHE_NAME); - const cursor = await cache.query(new ScanQuery()); - await cursor.getAll(); - await cursor.close(); - }). - then(done). - catch(error => done.fail(error)); - }); - - it('scan query settings', (done) => { - Promise.resolve(). - then(async () => { - let cache = igniteClient.getCache(CACHE_NAME); - const cursor = await cache.query(new ScanQuery(). - setPartitionNumber(0). - setPageSize(2). - setLocal(true)); - await cursor.getAll(); - await cursor.close(); - }). - then(done). - catch(error => done.fail(error)); - }); - - - it('scan empty cache', (done) => { - Promise.resolve(). - then(async () => { - let cache = igniteClient.getCache(CACHE_NAME); - await cache.removeAll(); - let cursor = await cache.query(new ScanQuery()); - const cacheEntries = await cursor.getAll(); - expect(cacheEntries.length).toBe(0); - await cursor.close(); - - cursor = await cache.query(new ScanQuery()); - expect(await cursor.getValue()).toBe(null); - expect(cursor.hasMore()).toBe(false); - await cursor.close(); - }). - then(done). - catch(error => done.fail(error)); - }); - - async function testSuiteCleanup(done) { - await TestingHelper.destroyCache(CACHE_NAME, done); - } - - async function generateData(done) { - try { - let cache = igniteClient.getCache(CACHE_NAME). - setKeyType(ObjectType.PRIMITIVE_TYPE.INTEGER); - for (let i = 0; i < ELEMENTS_NUMBER; i++) { - await cache.put(i, generateValue(i)); - } - } - catch (err) { - done.fail('unexpected error: ' + err); - } - } - - function generateValue(key) { - return 'value' + key; - } -}); diff --git a/modules/platforms/nodejs/spec/query/SqlFieldsQuery.spec.js b/modules/platforms/nodejs/spec/query/SqlFieldsQuery.spec.js deleted file mode 100644 index bf75759fe0574..0000000000000 --- a/modules/platforms/nodejs/spec/query/SqlFieldsQuery.spec.js +++ /dev/null @@ -1,266 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -'use strict'; - -require('jasmine-expect'); - -const config = require('../config'); -const TestingHelper = require('../TestingHelper'); -const IgniteClient = require('apache-ignite-client'); -const Errors = IgniteClient.Errors; -const SqlFieldsQuery = IgniteClient.SqlFieldsQuery; -const ObjectType = IgniteClient.ObjectType; -const CacheConfiguration = IgniteClient.CacheConfiguration; - -const CACHE_NAME = '__test_cache'; -const TABLE_NAME = '__test_SqlFieldsQuery_table'; -const ELEMENTS_NUMBER = 10; - -describe('sql fields query test suite >', () => { - let igniteClient = null; - - beforeAll((done) => { - Promise.resolve(). - then(async () => { - await TestingHelper.init(); - igniteClient = TestingHelper.igniteClient; - await testSuiteCleanup(done); - await igniteClient.getOrCreateCache(CACHE_NAME, new CacheConfiguration().setSqlSchema('PUBLIC')); - await generateData(done); - }). - then(done). - catch(error => done.fail(error)); - }, TestingHelper.TIMEOUT); - - afterAll((done) => { - Promise.resolve(). - then(async () => { - await dropTables(done); - await testSuiteCleanup(done); - await TestingHelper.cleanUp(); - }). - then(done). - catch(error => done()); - }, TestingHelper.TIMEOUT); - - it('get all', (done) => { - Promise.resolve(). - then(async () => { - let cache = igniteClient.getCache(CACHE_NAME); - const cursor = await cache.query( - new SqlFieldsQuery(`SELECT * FROM ${TABLE_NAME}`)); - const set = new Set(); - for (let fields of await cursor.getAll()) { - expect(fields.length).toBe(2); - expect(generateValue(fields[0]) === fields[1]).toBe(true); - set.add(fields[0]); - expect(fields[0] >= 0 && fields[0] < ELEMENTS_NUMBER).toBe(true); - } - expect(set.size).toBe(ELEMENTS_NUMBER); - }). - then(done). - catch(error => done.fail(error)); - }); - - it('get all with page size lazy true', (done) => { - Promise.resolve(). - then(async () => { - let cache = igniteClient.getCache(CACHE_NAME); - const cursor = await cache.query( - new SqlFieldsQuery(`SELECT * FROM ${TABLE_NAME}`).setPageSize(1).setLazy(true)); - const set = new Set(); - for (let fields of await cursor.getAll()) { - expect(fields.length).toBe(2); - expect(generateValue(fields[0]) === fields[1]).toBe(true); - set.add(fields[0]); - expect(fields[0] >= 0 && fields[0] < ELEMENTS_NUMBER).toBe(true); - } - expect(set.size).toBe(ELEMENTS_NUMBER); - }). - then(done). - catch(error => done.fail(error)); - }); - - it('get all with page size lazy false', (done) => { - Promise.resolve(). - then(async () => { - let cache = igniteClient.getCache(CACHE_NAME); - const cursor = await cache.query( - new SqlFieldsQuery(`SELECT * FROM ${TABLE_NAME}`).setPageSize(1).setLazy(false)); - const set = new Set(); - for (let fields of await cursor.getAll()) { - expect(fields.length).toBe(2); - expect(generateValue(fields[0]) === fields[1]).toBe(true); - set.add(fields[0]); - expect(fields[0] >= 0 && fields[0] < ELEMENTS_NUMBER).toBe(true); - } - expect(set.size).toBe(ELEMENTS_NUMBER); - }). - then(done). - catch(error => done.fail(error)); - }); - - it('get value', (done) => { - Promise.resolve(). - then(async () => { - let cache = igniteClient.getCache(CACHE_NAME); - const cursor = await cache.query( - new SqlFieldsQuery(`SELECT * FROM ${TABLE_NAME}`)); - const set = new Set(); - do { - let fields = await cursor.getValue(); - expect(fields.length).toBe(2); - expect(generateValue(fields[0]) === fields[1]).toBe(true); - set.add(fields[0]); - expect(fields[0] >= 0 && fields[0] < ELEMENTS_NUMBER).toBe(true); - } while (cursor.hasMore()); - expect(set.size).toBe(ELEMENTS_NUMBER); - }). - then(done). - catch(error => done.fail(error)); - }); - - it('get value with page size', (done) => { - Promise.resolve(). - then(async () => { - let cache = igniteClient.getCache(CACHE_NAME); - const cursor = await cache.query( - new SqlFieldsQuery(`SELECT * FROM ${TABLE_NAME}`).setPageSize(2)); - const set = new Set(); - do { - let fields = await cursor.getValue(); - expect(fields.length).toBe(2); - expect(generateValue(fields[0]) === fields[1]).toBe(true); - set.add(fields[0]); - expect(fields[0] >= 0 && fields[0] < ELEMENTS_NUMBER).toBe(true); - } while (cursor.hasMore()); - expect(set.size).toBe(ELEMENTS_NUMBER); - }). - then(done). - catch(error => done.fail(error)); - }); - - it('close cursor', (done) => { - Promise.resolve(). - then(async () => { - let cache = igniteClient.getCache(CACHE_NAME); - const cursor = await cache.query( - new SqlFieldsQuery(`SELECT * FROM ${TABLE_NAME}`).setPageSize(1)); - await cursor.getValue(); - await cursor.close(); - }). - then(done). - catch(error => done.fail(error)); - }); - - it('close cursor after get all', (done) => { - Promise.resolve(). - then(async () => { - let cache = igniteClient.getCache(CACHE_NAME); - const cursor = await cache.query(new SqlFieldsQuery(`SELECT * FROM ${TABLE_NAME}`)); - await cursor.getAll(); - await cursor.close(); - }). - then(done). - catch(error => done.fail(error)); - }); - - it('sql fields query settings', (done) => { - Promise.resolve(). - then(async () => { - let cache = igniteClient.getCache(CACHE_NAME); - const cursor = await cache.query(new SqlFieldsQuery(`SELECT * FROM ${TABLE_NAME}`). - setPageSize(2). - setLocal(false). - setSql(`INSERT INTO ${TABLE_NAME} (field1, field2) VALUES (?, ?)`). - setArgTypes(ObjectType.PRIMITIVE_TYPE.INTEGER, ObjectType.PRIMITIVE_TYPE.STRING). - setArgs(50, 'test'). - setDistributedJoins(true). - setReplicatedOnly(false). - setTimeout(10000). - setSchema('PUBLIC'). - setMaxRows(20). - setStatementType(SqlFieldsQuery.STATEMENT_TYPE.ANY). - setEnforceJoinOrder(true). - setCollocated(false). - setLazy(true). - setIncludeFieldNames(true)); - await cursor.getAll(); - await cursor.close(); - }). - then(done). - catch(error => done.fail(error)); - }); - - it('get empty results', (done) => { - Promise.resolve(). - then(async () => { - let cache = igniteClient.getCache(CACHE_NAME); - await cache.removeAll(); - let cursor = await cache.query( - new SqlFieldsQuery(`SELECT field1 FROM ${TABLE_NAME} WHERE field1 > 100`)); - const cacheEntries = await cursor.getAll(); - expect(cacheEntries.length).toBe(0); - await cursor.close(); - - cursor = await cache.query( - new SqlFieldsQuery(`SELECT field1 FROM ${TABLE_NAME} WHERE field1 > 100`)); - expect(await cursor.getValue()).toBe(null); - expect(cursor.hasMore()).toBe(false); - await cursor.close(); - }). - then(done). - catch(error => done.fail(error)); - }); - - async function dropTables(done) { - try { - let cache = igniteClient.getCache(CACHE_NAME); - (await cache.query(new SqlFieldsQuery(`DROP TABLE ${TABLE_NAME}`))).getAll(); - } - catch (err) { - done.fail('unexpected error: ' + err); - } - } - - async function testSuiteCleanup(done) { - await TestingHelper.destroyCache(CACHE_NAME, done); - } - - async function generateData(done) { - try { - let cache = igniteClient.getCache(CACHE_NAME); - (await cache.query(new SqlFieldsQuery( - `CREATE TABLE IF NOT EXISTS ${TABLE_NAME} (field1 INT, field2 VARCHAR, PRIMARY KEY (field1))`))).getAll(); - - const insertQuery = new SqlFieldsQuery(`INSERT INTO ${TABLE_NAME} (field1, field2) VALUES (?, ?)`). - setArgTypes(ObjectType.PRIMITIVE_TYPE.INTEGER); - - for (let i = 0; i < ELEMENTS_NUMBER; i++) { - (await cache.query(insertQuery.setArgs(i, generateValue(i)))).getAll(); - } - } - catch (err) { - done.fail('unexpected error: ' + err); - } - } - - function generateValue(key) { - return 'value' + key; - } -}); diff --git a/modules/platforms/nodejs/spec/query/SqlQuery.spec.js b/modules/platforms/nodejs/spec/query/SqlQuery.spec.js deleted file mode 100644 index c2e2bb148ac92..0000000000000 --- a/modules/platforms/nodejs/spec/query/SqlQuery.spec.js +++ /dev/null @@ -1,247 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -'use strict'; - -require('jasmine-expect'); - -const config = require('../config'); -const TestingHelper = require('../TestingHelper'); -const IgniteClient = require('apache-ignite-client'); -const Errors = IgniteClient.Errors; -const SqlQuery = IgniteClient.SqlQuery; -const SqlFieldsQuery = IgniteClient.SqlFieldsQuery; -const ObjectType = IgniteClient.ObjectType; -const CacheConfiguration = IgniteClient.CacheConfiguration; -const QueryEntity = IgniteClient.QueryEntity; -const QueryField = IgniteClient.QueryField; -const ComplexObjectType = IgniteClient.ComplexObjectType; - -const CACHE_NAME = '__test_cache'; -const TABLE_NAME = '__test_SqlQuery'; -const ELEMENTS_NUMBER = 10; - -describe('sql query test suite >', () => { - let igniteClient = null; - - beforeAll((done) => { - Promise.resolve(). - then(async () => { - await TestingHelper.init(); - igniteClient = TestingHelper.igniteClient; - await testSuiteCleanup(done); - await igniteClient.getOrCreateCache( - CACHE_NAME, - new CacheConfiguration(). - setQueryEntities( - new QueryEntity(). - setKeyTypeName('java.lang.Integer'). - setValueTypeName(TABLE_NAME). - setFields([ - new QueryField('field1', 'java.lang.Integer'), - new QueryField('field2', 'java.lang.String') - ]))); - await generateData(done); - }). - then(done). - catch(error => done.fail(error)); - }, TestingHelper.TIMEOUT); - - afterAll((done) => { - Promise.resolve(). - then(async () => { - await testSuiteCleanup(done); - await TestingHelper.cleanUp(); - }). - then(done). - catch(error => done()); - }, TestingHelper.TIMEOUT); - - it('get all', (done) => { - Promise.resolve(). - then(async () => { - let cache = getCache(); - const cursor = await cache.query( - new SqlQuery(TABLE_NAME, `SELECT * FROM ${TABLE_NAME}`)); - const set = new Set(); - for (let cacheEntry of await cursor.getAll()) { - expect(generateValue(cacheEntry.getKey()) === cacheEntry.getValue().field2).toBe(true); - set.add(cacheEntry.getKey()); - expect(cacheEntry.getKey() >= 0 && cacheEntry.getKey() < ELEMENTS_NUMBER).toBe(true); - } - expect(set.size).toBe(ELEMENTS_NUMBER); - }). - then(done). - catch(error => done.fail(error)); - }); - - it('get all with page size', (done) => { - Promise.resolve(). - then(async () => { - let cache = getCache(); - const cursor = await cache.query( - new SqlQuery(TABLE_NAME, `SELECT * FROM ${TABLE_NAME}`).setPageSize(1)); - const set = new Set(); - for (let cacheEntry of await cursor.getAll()) { - expect(generateValue(cacheEntry.getKey()) === cacheEntry.getValue().field2).toBe(true); - set.add(cacheEntry.getKey()); - expect(cacheEntry.getKey() >= 0 && cacheEntry.getKey() < ELEMENTS_NUMBER).toBe(true); - } - expect(set.size).toBe(ELEMENTS_NUMBER); - }). - then(done). - catch(error => done.fail(error)); - }); - - it('get value', (done) => { - Promise.resolve(). - then(async () => { - let cache = getCache(); - const cursor = await cache.query( - new SqlQuery(TABLE_NAME, `SELECT * FROM ${TABLE_NAME}`)); - const set = new Set(); - do { - let cacheEntry = await cursor.getValue(); - expect(generateValue(cacheEntry.getKey()) === cacheEntry.getValue().field2).toBe(true); - set.add(cacheEntry.getKey()); - expect(cacheEntry.getKey() >= 0 && cacheEntry.getKey() < ELEMENTS_NUMBER).toBe(true); - } while (cursor.hasMore()); - expect(set.size).toBe(ELEMENTS_NUMBER); - }). - then(done). - catch(error => done.fail(error)); - }); - - it('get value with page size', (done) => { - Promise.resolve(). - then(async () => { - let cache = getCache(); - const cursor = await cache.query( - new SqlQuery(TABLE_NAME, `SELECT * FROM ${TABLE_NAME}`).setPageSize(2)); - const set = new Set(); - do { - let cacheEntry = await cursor.getValue(); - expect(generateValue(cacheEntry.getKey()) === cacheEntry.getValue().field2).toBe(true); - set.add(cacheEntry.getKey()); - expect(cacheEntry.getKey() >= 0 && cacheEntry.getKey() < ELEMENTS_NUMBER).toBe(true); - } while (cursor.hasMore()); - expect(set.size).toBe(ELEMENTS_NUMBER); - }). - then(done). - catch(error => done.fail(error)); - }); - - it('close cursor', (done) => { - Promise.resolve(). - then(async () => { - let cache = getCache(); - const cursor = await cache.query( - new SqlQuery(TABLE_NAME, `SELECT * FROM ${TABLE_NAME}`).setPageSize(1)); - await cursor.getValue(); - await cursor.close(); - }). - then(done). - catch(error => done.fail(error)); - }); - - it('close cursor after get all', (done) => { - Promise.resolve(). - then(async () => { - let cache = getCache(); - const cursor = await cache.query( - new SqlQuery(TABLE_NAME, `SELECT * FROM ${TABLE_NAME}`)); - await cursor.getAll(); - await cursor.close(); - }). - then(done). - catch(error => done.fail(error)); - }); - - it('sql query settings', (done) => { - Promise.resolve(). - then(async () => { - let cache = getCache(); - const cursor = await cache.query(new SqlQuery(TABLE_NAME, `SELECT * FROM ${TABLE_NAME}`). - setType(TABLE_NAME). - setPageSize(2). - setLocal(false). - setSql('field1 > ? and field1 <= ?'). - setArgTypes(ObjectType.PRIMITIVE_TYPE.INTEGER, ObjectType.PRIMITIVE_TYPE.INTEGER). - setArgs(3, 7). - setDistributedJoins(true). - setReplicatedOnly(false). - setTimeout(10000)); - await cursor.getAll(); - await cursor.close(); - }). - then(done). - catch(error => done.fail(error)); - }); - - it('get values from empty cache', (done) => { - Promise.resolve(). - then(async () => { - let cache = getCache(); - await cache.removeAll(); - let cursor = await cache.query(new SqlQuery(TABLE_NAME, `SELECT * FROM ${TABLE_NAME}`).setPageSize(1)); - const cacheEntries = await cursor.getAll(); - expect(cacheEntries.length).toBe(0); - await cursor.close(); - - cursor = await cache.query(new SqlQuery(TABLE_NAME, `SELECT * FROM ${TABLE_NAME}`).setPageSize(1)); - expect(await cursor.getValue()).toBe(null); - expect(cursor.hasMore()).toBe(false); - await cursor.close(); - }). - then(done). - catch(error => done.fail(error)); - }); - - async function testSuiteCleanup(done) { - await TestingHelper.destroyCache(CACHE_NAME, done); - } - - function getCache() { - return igniteClient.getCache(CACHE_NAME). - setKeyType(ObjectType.PRIMITIVE_TYPE.INTEGER). - setValueType(new ComplexObjectType({ - 'field1' : 1, - 'field2' : 'a' - }, TABLE_NAME). - setFieldType('field1', ObjectType.PRIMITIVE_TYPE.INTEGER)); - } - - async function generateData(done) { - try { - let cache = igniteClient.getCache(CACHE_NAME); - - const insertQuery = new SqlFieldsQuery(`INSERT INTO ${TABLE_NAME} (_key, field1, field2) VALUES (?, ?, ?)`). - setArgTypes(ObjectType.PRIMITIVE_TYPE.INTEGER, ObjectType.PRIMITIVE_TYPE.INTEGER); - - for (let i = 0; i < ELEMENTS_NUMBER; i++) { - (await cache.query(insertQuery.setArgs(i, i, generateValue(i)))).getAll(); - } - } - catch (err) { - done.fail('unexpected error: ' + err); - } - } - - function generateValue(key) { - return 'value' + key; - } -}); diff --git a/modules/platforms/nodejs/spec/support/jasmine.json b/modules/platforms/nodejs/spec/support/jasmine.json deleted file mode 100644 index 8ba68babf0672..0000000000000 --- a/modules/platforms/nodejs/spec/support/jasmine.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "spec_dir": "spec", - "spec_files": [ - "cache/**/*[sS]pec.js", - "query/**/*[sS]pec.js" - ], - "helpers": [ - "helpers/**/*.js" - ], - "random": false -} diff --git a/modules/platforms/php/.gitignore b/modules/platforms/php/.gitignore deleted file mode 100644 index 4f4acd356ffd7..0000000000000 --- a/modules/platforms/php/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -vendor/ -composer.lock \ No newline at end of file diff --git a/modules/platforms/php/README.md b/modules/platforms/php/README.md deleted file mode 100644 index d6cd51dd7d550..0000000000000 --- a/modules/platforms/php/README.md +++ /dev/null @@ -1,37 +0,0 @@ -# PHP Thin Client # - -## Installation ## - -The client requires PHP version 7.2 or higher (http://php.net/manual/en/install.php) and Composer Dependency Manager (https://getcomposer.org/download/). - -The client additionally requires PHP Multibyte String extension. Depending on you PHP configuration you may need to additionally install/configure it (http://php.net/manual/en/mbstring.installation.php) - -### Installation from the PHP Package Repository ### - -Run from your application root -``` -composer require apache/apache-ignite-client -``` - -To use the client in your application, include `vendor/autoload.php` file, generated by Composer, to your source code, eg. -``` -require_once __DIR__ . '/vendor/autoload.php'; -``` - -### Installation from Sources ### - -1. Download Ignite sources to `local_ignite_path` -2. Go to `local_ignite_path/modules/platforms/php` folder -3. Execute `composer install --no-dev` command - -```bash -cd local_ignite_path/modules/platforms/php -composer install --no-dev -``` - -To use the client in your application, include `vendor/autoload.php` file, generated by Composer, to your source code, eg. -``` -require_once "/vendor/autoload.php"; -``` - -For more information, see [Apache Ignite PHP Thin Client documentation](https://apacheignite.readme.io/docs/php-thin-client). diff --git a/modules/platforms/php/api_docs/Doxyfile b/modules/platforms/php/api_docs/Doxyfile deleted file mode 100644 index 23924633eecc9..0000000000000 --- a/modules/platforms/php/api_docs/Doxyfile +++ /dev/null @@ -1,2487 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Doxyfile 1.8.14 - -# This file describes the settings to be used by the documentation system -# doxygen (www.doxygen.org) for a project. -# -# All text after a double hash (##) is considered a comment and is placed in -# front of the TAG it is preceding. -# -# All text after a single hash (#) is considered a comment and will be ignored. -# The format is: -# TAG = value [value, ...] -# For lists, items can also be appended using: -# TAG += value [value, ...] -# Values that contain spaces should be placed between quotes (\" \"). - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- - -# This tag specifies the encoding used for all characters in the config file -# that follow. The default is UTF-8 which is also the encoding used for all text -# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv -# built into libc) for the transcoding. See -# https://www.gnu.org/software/libiconv/ for the list of possible encodings. -# The default value is: UTF-8. - -DOXYFILE_ENCODING = UTF-8 - -# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by -# double-quotes, unless you are using Doxywizard) that should identify the -# project for which the documentation is generated. This name is used in the -# title of most generated pages and in a few other places. -# The default value is: My Project. - -PROJECT_NAME = "PHP Client for Apache Ignite" - -# The PROJECT_NUMBER tag can be used to enter a project or revision number. This -# could be handy for archiving the generated documentation or if some version -# control system is used. - -PROJECT_NUMBER = - -# Using the PROJECT_BRIEF tag one can provide an optional one line description -# for a project that appears at the top of each page and should give viewer a -# quick idea about the purpose of the project. Keep the description short. - -PROJECT_BRIEF = - -# With the PROJECT_LOGO tag one can specify a logo or an icon that is included -# in the documentation. The maximum height of the logo should not exceed 55 -# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy -# the logo to the output directory. - -PROJECT_LOGO = - -# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path -# into which the generated documentation will be written. If a relative path is -# entered, it will be relative to the location where doxygen was started. If -# left blank the current directory will be used. - -OUTPUT_DIRECTORY = api_docs - -# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub- -# directories (in 2 levels) under the output directory of each output format and -# will distribute the generated files over these directories. Enabling this -# option can be useful when feeding doxygen a huge amount of source files, where -# putting all generated files in the same directory would otherwise causes -# performance problems for the file system. -# The default value is: NO. - -CREATE_SUBDIRS = NO - -# If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII -# characters to appear in the names of generated files. If set to NO, non-ASCII -# characters will be escaped, for example _xE3_x81_x84 will be used for Unicode -# U+3044. -# The default value is: NO. - -ALLOW_UNICODE_NAMES = NO - -# The OUTPUT_LANGUAGE tag is used to specify the language in which all -# documentation generated by doxygen is written. Doxygen will use this -# information to generate all constant output in the proper language. -# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese, -# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States), -# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian, -# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages), -# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian, -# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian, -# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish, -# Ukrainian and Vietnamese. -# The default value is: English. - -OUTPUT_LANGUAGE = English - -# If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member -# descriptions after the members that are listed in the file and class -# documentation (similar to Javadoc). Set to NO to disable this. -# The default value is: YES. - -BRIEF_MEMBER_DESC = YES - -# If the REPEAT_BRIEF tag is set to YES, doxygen will prepend the brief -# description of a member or function before the detailed description -# -# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the -# brief descriptions will be completely suppressed. -# The default value is: YES. - -REPEAT_BRIEF = YES - -# This tag implements a quasi-intelligent brief description abbreviator that is -# used to form the text in various listings. Each string in this list, if found -# as the leading text of the brief description, will be stripped from the text -# and the result, after processing the whole list, is used as the annotated -# text. Otherwise, the brief description is used as-is. If left blank, the -# following values are used ($name is automatically replaced with the name of -# the entity):The $name class, The $name widget, The $name file, is, provides, -# specifies, contains, represents, a, an and the. - -ABBREVIATE_BRIEF = "The $name class" \ - "The $name widget" \ - "The $name file" \ - is \ - provides \ - specifies \ - contains \ - represents \ - a \ - an \ - the - -# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then -# doxygen will generate a detailed section even if there is only a brief -# description. -# The default value is: NO. - -ALWAYS_DETAILED_SEC = NO - -# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all -# inherited members of a class in the documentation of that class as if those -# members were ordinary class members. Constructors, destructors and assignment -# operators of the base classes will not be shown. -# The default value is: NO. - -INLINE_INHERITED_MEMB = NO - -# If the FULL_PATH_NAMES tag is set to YES, doxygen will prepend the full path -# before files name in the file list and in the header files. If set to NO the -# shortest path that makes the file name unique will be used -# The default value is: YES. - -FULL_PATH_NAMES = YES - -# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path. -# Stripping is only done if one of the specified strings matches the left-hand -# part of the path. The tag can be used to show relative paths in the file list. -# If left blank the directory from which doxygen is run is used as the path to -# strip. -# -# Note that you can specify absolute paths here, but also relative paths, which -# will be relative from the directory where doxygen is started. -# This tag requires that the tag FULL_PATH_NAMES is set to YES. - -STRIP_FROM_PATH = - -# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the -# path mentioned in the documentation of a class, which tells the reader which -# header file to include in order to use a class. If left blank only the name of -# the header file containing the class definition is used. Otherwise one should -# specify the list of include paths that are normally passed to the compiler -# using the -I flag. - -STRIP_FROM_INC_PATH = - -# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but -# less readable) file names. This can be useful is your file systems doesn't -# support long names like on DOS, Mac, or CD-ROM. -# The default value is: NO. - -SHORT_NAMES = NO - -# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the -# first line (until the first dot) of a Javadoc-style comment as the brief -# description. If set to NO, the Javadoc-style will behave just like regular Qt- -# style comments (thus requiring an explicit @brief command for a brief -# description.) -# The default value is: NO. - -JAVADOC_AUTOBRIEF = NO - -# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first -# line (until the first dot) of a Qt-style comment as the brief description. If -# set to NO, the Qt-style will behave just like regular Qt-style comments (thus -# requiring an explicit \brief command for a brief description.) -# The default value is: NO. - -QT_AUTOBRIEF = NO - -# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a -# multi-line C++ special comment block (i.e. a block of //! or /// comments) as -# a brief description. This used to be the default behavior. The new default is -# to treat a multi-line C++ comment block as a detailed description. Set this -# tag to YES if you prefer the old behavior instead. -# -# Note that setting this tag to YES also means that rational rose comments are -# not recognized any more. -# The default value is: NO. - -MULTILINE_CPP_IS_BRIEF = NO - -# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the -# documentation from any documented member that it re-implements. -# The default value is: YES. - -INHERIT_DOCS = YES - -# If the SEPARATE_MEMBER_PAGES tag is set to YES then doxygen will produce a new -# page for each member. If set to NO, the documentation of a member will be part -# of the file/class/namespace that contains it. -# The default value is: NO. - -SEPARATE_MEMBER_PAGES = NO - -# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen -# uses this value to replace tabs by spaces in code fragments. -# Minimum value: 1, maximum value: 16, default value: 4. - -TAB_SIZE = 4 - -# This tag can be used to specify a number of aliases that act as commands in -# the documentation. An alias has the form: -# name=value -# For example adding -# "sideeffect=@par Side Effects:\n" -# will allow you to put the command \sideeffect (or @sideeffect) in the -# documentation, which will result in a user-defined paragraph with heading -# "Side Effects:". You can put \n's in the value part of an alias to insert -# newlines (in the resulting output). You can put ^^ in the value part of an -# alias to insert a newline as if a physical newline was in the original file. - -ALIASES = - -# This tag can be used to specify a number of word-keyword mappings (TCL only). -# A mapping has the form "name=value". For example adding "class=itcl::class" -# will allow you to use the command class in the itcl::class meaning. - -TCL_SUBST = - -# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources -# only. Doxygen will then generate output that is more tailored for C. For -# instance, some of the names that are used will be different. The list of all -# members will be omitted, etc. -# The default value is: NO. - -OPTIMIZE_OUTPUT_FOR_C = NO - -# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or -# Python sources only. Doxygen will then generate output that is more tailored -# for that language. For instance, namespaces will be presented as packages, -# qualified scopes will look different, etc. -# The default value is: NO. - -OPTIMIZE_OUTPUT_JAVA = NO - -# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran -# sources. Doxygen will then generate output that is tailored for Fortran. -# The default value is: NO. - -OPTIMIZE_FOR_FORTRAN = NO - -# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL -# sources. Doxygen will then generate output that is tailored for VHDL. -# The default value is: NO. - -OPTIMIZE_OUTPUT_VHDL = NO - -# Doxygen selects the parser to use depending on the extension of the files it -# parses. With this tag you can assign which parser to use for a given -# extension. Doxygen has a built-in mapping, but you can override or extend it -# using this tag. The format is ext=language, where ext is a file extension, and -# language is one of the parsers supported by doxygen: IDL, Java, Javascript, -# C#, C, C++, D, PHP, Objective-C, Python, Fortran (fixed format Fortran: -# FortranFixed, free formatted Fortran: FortranFree, unknown formatted Fortran: -# Fortran. In the later case the parser tries to guess whether the code is fixed -# or free formatted code, this is the default for Fortran type files), VHDL. For -# instance to make doxygen treat .inc files as Fortran files (default is PHP), -# and .f files as C (default is Fortran), use: inc=Fortran f=C. -# -# Note: For files without extension you can use no_extension as a placeholder. -# -# Note that for custom extensions you also need to set FILE_PATTERNS otherwise -# the files are not read by doxygen. - -EXTENSION_MAPPING = - -# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments -# according to the Markdown format, which allows for more readable -# documentation. See http://daringfireball.net/projects/markdown/ for details. -# The output of markdown processing is further processed by doxygen, so you can -# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in -# case of backward compatibilities issues. -# The default value is: YES. - -MARKDOWN_SUPPORT = YES - -# When the TOC_INCLUDE_HEADINGS tag is set to a non-zero value, all headings up -# to that level are automatically included in the table of contents, even if -# they do not have an id attribute. -# Note: This feature currently applies only to Markdown headings. -# Minimum value: 0, maximum value: 99, default value: 0. -# This tag requires that the tag MARKDOWN_SUPPORT is set to YES. - -TOC_INCLUDE_HEADINGS = 0 - -# When enabled doxygen tries to link words that correspond to documented -# classes, or namespaces to their corresponding documentation. Such a link can -# be prevented in individual cases by putting a % sign in front of the word or -# globally by setting AUTOLINK_SUPPORT to NO. -# The default value is: YES. - -AUTOLINK_SUPPORT = YES - -# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want -# to include (a tag file for) the STL sources as input, then you should set this -# tag to YES in order to let doxygen match functions declarations and -# definitions whose arguments contain STL classes (e.g. func(std::string); -# versus func(std::string) {}). This also make the inheritance and collaboration -# diagrams that involve STL classes more complete and accurate. -# The default value is: NO. - -BUILTIN_STL_SUPPORT = NO - -# If you use Microsoft's C++/CLI language, you should set this option to YES to -# enable parsing support. -# The default value is: NO. - -CPP_CLI_SUPPORT = NO - -# Set the SIP_SUPPORT tag to YES if your project consists of sip (see: -# https://www.riverbankcomputing.com/software/sip/intro) sources only. Doxygen -# will parse them like normal C++ but will assume all classes use public instead -# of private inheritance when no explicit protection keyword is present. -# The default value is: NO. - -SIP_SUPPORT = NO - -# For Microsoft's IDL there are propget and propput attributes to indicate -# getter and setter methods for a property. Setting this option to YES will make -# doxygen to replace the get and set methods by a property in the documentation. -# This will only work if the methods are indeed getting or setting a simple -# type. If this is not the case, or you want to show the methods anyway, you -# should set this option to NO. -# The default value is: YES. - -IDL_PROPERTY_SUPPORT = YES - -# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC -# tag is set to YES then doxygen will reuse the documentation of the first -# member in the group (if any) for the other members of the group. By default -# all members of a group must be documented explicitly. -# The default value is: NO. - -DISTRIBUTE_GROUP_DOC = NO - -# If one adds a struct or class to a group and this option is enabled, then also -# any nested class or struct is added to the same group. By default this option -# is disabled and one has to add nested compounds explicitly via \ingroup. -# The default value is: NO. - -GROUP_NESTED_COMPOUNDS = NO - -# Set the SUBGROUPING tag to YES to allow class member groups of the same type -# (for instance a group of public functions) to be put as a subgroup of that -# type (e.g. under the Public Functions section). Set it to NO to prevent -# subgrouping. Alternatively, this can be done per class using the -# \nosubgrouping command. -# The default value is: YES. - -SUBGROUPING = YES - -# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions -# are shown inside the group in which they are included (e.g. using \ingroup) -# instead of on a separate page (for HTML and Man pages) or section (for LaTeX -# and RTF). -# -# Note that this feature does not work in combination with -# SEPARATE_MEMBER_PAGES. -# The default value is: NO. - -INLINE_GROUPED_CLASSES = NO - -# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions -# with only public data fields or simple typedef fields will be shown inline in -# the documentation of the scope in which they are defined (i.e. file, -# namespace, or group documentation), provided this scope is documented. If set -# to NO, structs, classes, and unions are shown on a separate page (for HTML and -# Man pages) or section (for LaTeX and RTF). -# The default value is: NO. - -INLINE_SIMPLE_STRUCTS = NO - -# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or -# enum is documented as struct, union, or enum with the name of the typedef. So -# typedef struct TypeS {} TypeT, will appear in the documentation as a struct -# with name TypeT. When disabled the typedef will appear as a member of a file, -# namespace, or class. And the struct will be named TypeS. This can typically be -# useful for C code in case the coding convention dictates that all compound -# types are typedef'ed and only the typedef is referenced, never the tag name. -# The default value is: NO. - -TYPEDEF_HIDES_STRUCT = NO - -# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This -# cache is used to resolve symbols given their name and scope. Since this can be -# an expensive process and often the same symbol appears multiple times in the -# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small -# doxygen will become slower. If the cache is too large, memory is wasted. The -# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range -# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536 -# symbols. At the end of a run doxygen will report the cache usage and suggest -# the optimal cache size from a speed point of view. -# Minimum value: 0, maximum value: 9, default value: 0. - -LOOKUP_CACHE_SIZE = 0 - -#--------------------------------------------------------------------------- -# Build related configuration options -#--------------------------------------------------------------------------- - -# If the EXTRACT_ALL tag is set to YES, doxygen will assume all entities in -# documentation are documented, even if no documentation was available. Private -# class members and static file members will be hidden unless the -# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES. -# Note: This will also disable the warnings about undocumented members that are -# normally produced when WARNINGS is set to YES. -# The default value is: NO. - -EXTRACT_ALL = NO - -# If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will -# be included in the documentation. -# The default value is: NO. - -EXTRACT_PRIVATE = NO - -# If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal -# scope will be included in the documentation. -# The default value is: NO. - -EXTRACT_PACKAGE = NO - -# If the EXTRACT_STATIC tag is set to YES, all static members of a file will be -# included in the documentation. -# The default value is: NO. - -EXTRACT_STATIC = NO - -# If the EXTRACT_LOCAL_CLASSES tag is set to YES, classes (and structs) defined -# locally in source files will be included in the documentation. If set to NO, -# only classes defined in header files are included. Does not have any effect -# for Java sources. -# The default value is: YES. - -EXTRACT_LOCAL_CLASSES = YES - -# This flag is only useful for Objective-C code. If set to YES, local methods, -# which are defined in the implementation section but not in the interface are -# included in the documentation. If set to NO, only methods in the interface are -# included. -# The default value is: NO. - -EXTRACT_LOCAL_METHODS = NO - -# If this flag is set to YES, the members of anonymous namespaces will be -# extracted and appear in the documentation as a namespace called -# 'anonymous_namespace{file}', where file will be replaced with the base name of -# the file that contains the anonymous namespace. By default anonymous namespace -# are hidden. -# The default value is: NO. - -EXTRACT_ANON_NSPACES = NO - -# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all -# undocumented members inside documented classes or files. If set to NO these -# members will be included in the various overviews, but no documentation -# section is generated. This option has no effect if EXTRACT_ALL is enabled. -# The default value is: NO. - -HIDE_UNDOC_MEMBERS = YES - -# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all -# undocumented classes that are normally visible in the class hierarchy. If set -# to NO, these classes will be included in the various overviews. This option -# has no effect if EXTRACT_ALL is enabled. -# The default value is: NO. - -HIDE_UNDOC_CLASSES = NO - -# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend -# (class|struct|union) declarations. If set to NO, these declarations will be -# included in the documentation. -# The default value is: NO. - -HIDE_FRIEND_COMPOUNDS = NO - -# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any -# documentation blocks found inside the body of a function. If set to NO, these -# blocks will be appended to the function's detailed documentation block. -# The default value is: NO. - -HIDE_IN_BODY_DOCS = NO - -# The INTERNAL_DOCS tag determines if documentation that is typed after a -# \internal command is included. If the tag is set to NO then the documentation -# will be excluded. Set it to YES to include the internal documentation. -# The default value is: NO. - -INTERNAL_DOCS = NO - -# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file -# names in lower-case letters. If set to YES, upper-case letters are also -# allowed. This is useful if you have classes or files whose names only differ -# in case and if your file system supports case sensitive file names. Windows -# and Mac users are advised to set this option to NO. -# The default value is: system dependent. - -CASE_SENSE_NAMES = NO - -# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with -# their full class and namespace scopes in the documentation. If set to YES, the -# scope will be hidden. -# The default value is: NO. - -HIDE_SCOPE_NAMES = NO - -# If the HIDE_COMPOUND_REFERENCE tag is set to NO (default) then doxygen will -# append additional text to a page's title, such as Class Reference. If set to -# YES the compound reference will be hidden. -# The default value is: NO. - -HIDE_COMPOUND_REFERENCE= NO - -# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of -# the files that are included by a file in the documentation of that file. -# The default value is: YES. - -SHOW_INCLUDE_FILES = YES - -# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each -# grouped member an include statement to the documentation, telling the reader -# which file to include in order to use the member. -# The default value is: NO. - -SHOW_GROUPED_MEMB_INC = NO - -# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include -# files with double quotes in the documentation rather than with sharp brackets. -# The default value is: NO. - -FORCE_LOCAL_INCLUDES = NO - -# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the -# documentation for inline members. -# The default value is: YES. - -INLINE_INFO = YES - -# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the -# (detailed) documentation of file and class members alphabetically by member -# name. If set to NO, the members will appear in declaration order. -# The default value is: YES. - -SORT_MEMBER_DOCS = YES - -# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief -# descriptions of file, namespace and class members alphabetically by member -# name. If set to NO, the members will appear in declaration order. Note that -# this will also influence the order of the classes in the class list. -# The default value is: NO. - -SORT_BRIEF_DOCS = NO - -# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the -# (brief and detailed) documentation of class members so that constructors and -# destructors are listed first. If set to NO the constructors will appear in the -# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS. -# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief -# member documentation. -# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting -# detailed member documentation. -# The default value is: NO. - -SORT_MEMBERS_CTORS_1ST = NO - -# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy -# of group names into alphabetical order. If set to NO the group names will -# appear in their defined order. -# The default value is: NO. - -SORT_GROUP_NAMES = NO - -# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by -# fully-qualified names, including namespaces. If set to NO, the class list will -# be sorted only by class name, not including the namespace part. -# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. -# Note: This option applies only to the class list, not to the alphabetical -# list. -# The default value is: NO. - -SORT_BY_SCOPE_NAME = NO - -# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper -# type resolution of all parameters of a function it will reject a match between -# the prototype and the implementation of a member function even if there is -# only one candidate or it is obvious which candidate to choose by doing a -# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still -# accept a match between prototype and implementation in such cases. -# The default value is: NO. - -STRICT_PROTO_MATCHING = NO - -# The GENERATE_TODOLIST tag can be used to enable (YES) or disable (NO) the todo -# list. This list is created by putting \todo commands in the documentation. -# The default value is: YES. - -GENERATE_TODOLIST = YES - -# The GENERATE_TESTLIST tag can be used to enable (YES) or disable (NO) the test -# list. This list is created by putting \test commands in the documentation. -# The default value is: YES. - -GENERATE_TESTLIST = YES - -# The GENERATE_BUGLIST tag can be used to enable (YES) or disable (NO) the bug -# list. This list is created by putting \bug commands in the documentation. -# The default value is: YES. - -GENERATE_BUGLIST = YES - -# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or disable (NO) -# the deprecated list. This list is created by putting \deprecated commands in -# the documentation. -# The default value is: YES. - -GENERATE_DEPRECATEDLIST= YES - -# The ENABLED_SECTIONS tag can be used to enable conditional documentation -# sections, marked by \if ... \endif and \cond -# ... \endcond blocks. - -ENABLED_SECTIONS = - -# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the -# initial value of a variable or macro / define can have for it to appear in the -# documentation. If the initializer consists of more lines than specified here -# it will be hidden. Use a value of 0 to hide initializers completely. The -# appearance of the value of individual variables and macros / defines can be -# controlled using \showinitializer or \hideinitializer command in the -# documentation regardless of this setting. -# Minimum value: 0, maximum value: 10000, default value: 30. - -MAX_INITIALIZER_LINES = 30 - -# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at -# the bottom of the documentation of classes and structs. If set to YES, the -# list will mention the files that were used to generate the documentation. -# The default value is: YES. - -SHOW_USED_FILES = YES - -# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This -# will remove the Files entry from the Quick Index and from the Folder Tree View -# (if specified). -# The default value is: YES. - -SHOW_FILES = YES - -# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces -# page. This will remove the Namespaces entry from the Quick Index and from the -# Folder Tree View (if specified). -# The default value is: YES. - -SHOW_NAMESPACES = YES - -# The FILE_VERSION_FILTER tag can be used to specify a program or script that -# doxygen should invoke to get the current version for each file (typically from -# the version control system). Doxygen will invoke the program by executing (via -# popen()) the command command input-file, where command is the value of the -# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided -# by doxygen. Whatever the program writes to standard output is used as the file -# version. For an example see the documentation. - -FILE_VERSION_FILTER = - -# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed -# by doxygen. The layout file controls the global structure of the generated -# output files in an output format independent way. To create the layout file -# that represents doxygen's defaults, run doxygen with the -l option. You can -# optionally specify a file name after the option, if omitted DoxygenLayout.xml -# will be used as the name of the layout file. -# -# Note that if you run doxygen from a directory containing a file called -# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE -# tag is left empty. - -LAYOUT_FILE = - -# The CITE_BIB_FILES tag can be used to specify one or more bib files containing -# the reference definitions. This must be a list of .bib files. The .bib -# extension is automatically appended if omitted. This requires the bibtex tool -# to be installed. See also https://en.wikipedia.org/wiki/BibTeX for more info. -# For LaTeX the style of the bibliography can be controlled using -# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the -# search path. See also \cite for info how to create references. - -CITE_BIB_FILES = - -#--------------------------------------------------------------------------- -# Configuration options related to warning and progress messages -#--------------------------------------------------------------------------- - -# The QUIET tag can be used to turn on/off the messages that are generated to -# standard output by doxygen. If QUIET is set to YES this implies that the -# messages are off. -# The default value is: NO. - -QUIET = NO - -# The WARNINGS tag can be used to turn on/off the warning messages that are -# generated to standard error (stderr) by doxygen. If WARNINGS is set to YES -# this implies that the warnings are on. -# -# Tip: Turn warnings on while writing the documentation. -# The default value is: YES. - -WARNINGS = YES - -# If the WARN_IF_UNDOCUMENTED tag is set to YES then doxygen will generate -# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag -# will automatically be disabled. -# The default value is: YES. - -WARN_IF_UNDOCUMENTED = YES - -# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for -# potential errors in the documentation, such as not documenting some parameters -# in a documented function, or documenting parameters that don't exist or using -# markup commands wrongly. -# The default value is: YES. - -WARN_IF_DOC_ERROR = YES - -# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that -# are documented, but have no documentation for their parameters or return -# value. If set to NO, doxygen will only warn about wrong or incomplete -# parameter documentation, but not about the absence of documentation. -# The default value is: NO. - -WARN_NO_PARAMDOC = NO - -# If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when -# a warning is encountered. -# The default value is: NO. - -WARN_AS_ERROR = NO - -# The WARN_FORMAT tag determines the format of the warning messages that doxygen -# can produce. The string should contain the $file, $line, and $text tags, which -# will be replaced by the file and line number from which the warning originated -# and the warning text. Optionally the format may contain $version, which will -# be replaced by the version of the file (if it could be obtained via -# FILE_VERSION_FILTER) -# The default value is: $file:$line: $text. - -WARN_FORMAT = "$file:$line: $text" - -# The WARN_LOGFILE tag can be used to specify a file to which warning and error -# messages should be written. If left blank the output is written to standard -# error (stderr). - -WARN_LOGFILE = - -#--------------------------------------------------------------------------- -# Configuration options related to the input files -#--------------------------------------------------------------------------- - -# The INPUT tag is used to specify the files and/or directories that contain -# documented source files. You may enter file names like myfile.cpp or -# directories like /usr/src/myproject. Separate the files or directories with -# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING -# Note: If this tag is empty the current directory is searched. - -INPUT = src - -# This tag can be used to specify the character encoding of the source files -# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses -# libiconv (or the iconv built into libc) for the transcoding. See the libiconv -# documentation (see: https://www.gnu.org/software/libiconv/) for the list of -# possible encodings. -# The default value is: UTF-8. - -INPUT_ENCODING = UTF-8 - -# If the value of the INPUT tag contains directories, you can use the -# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and -# *.h) to filter out the source-files in the directories. -# -# Note that for custom extensions or not directly supported extensions you also -# need to set EXTENSION_MAPPING for the extension otherwise the files are not -# read by doxygen. -# -# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp, -# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, -# *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, -# *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, -# *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf and *.qsf. - -FILE_PATTERNS = *.php \ - *.php4 \ - *.php5 \ - *.phtml - -# The RECURSIVE tag can be used to specify whether or not subdirectories should -# be searched for input files as well. -# The default value is: NO. - -RECURSIVE = YES - -# The EXCLUDE tag can be used to specify files and/or directories that should be -# excluded from the INPUT source files. This way you can easily exclude a -# subdirectory from a directory tree whose root is specified with the INPUT tag. -# -# Note that relative paths are relative to the directory from which doxygen is -# run. - -EXCLUDE = src/Apache/Ignite/Internal - -# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or -# directories that are symbolic links (a Unix file system feature) are excluded -# from the input. -# The default value is: NO. - -EXCLUDE_SYMLINKS = NO - -# If the value of the INPUT tag contains directories, you can use the -# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude -# certain files from those directories. -# -# Note that the wildcards are matched against the file with absolute path, so to -# exclude all test directories for example use the pattern */test/* - -EXCLUDE_PATTERNS = - -# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names -# (namespaces, classes, functions, etc.) that should be excluded from the -# output. The symbol name can be a fully qualified name, a word, or if the -# wildcard * is used, a substring. Examples: ANamespace, AClass, -# AClass::ANamespace, ANamespace::*Test -# -# Note that the wildcards are matched against the file with absolute path, so to -# exclude all test directories use the pattern */test/* - -EXCLUDE_SYMBOLS = - -# The EXAMPLE_PATH tag can be used to specify one or more files or directories -# that contain example code fragments that are included (see the \include -# command). - -EXAMPLE_PATH = - -# If the value of the EXAMPLE_PATH tag contains directories, you can use the -# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and -# *.h) to filter out the source-files in the directories. If left blank all -# files are included. - -EXAMPLE_PATTERNS = * - -# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be -# searched for input files to be used with the \include or \dontinclude commands -# irrespective of the value of the RECURSIVE tag. -# The default value is: NO. - -EXAMPLE_RECURSIVE = NO - -# The IMAGE_PATH tag can be used to specify one or more files or directories -# that contain images that are to be included in the documentation (see the -# \image command). - -IMAGE_PATH = - -# The INPUT_FILTER tag can be used to specify a program that doxygen should -# invoke to filter for each input file. Doxygen will invoke the filter program -# by executing (via popen()) the command: -# -# -# -# where is the value of the INPUT_FILTER tag, and is the -# name of an input file. Doxygen will then use the output that the filter -# program writes to standard output. If FILTER_PATTERNS is specified, this tag -# will be ignored. -# -# Note that the filter must not add or remove lines; it is applied before the -# code is scanned, but not when the output code is generated. If lines are added -# or removed, the anchors will not be placed correctly. -# -# Note that for custom extensions or not directly supported extensions you also -# need to set EXTENSION_MAPPING for the extension otherwise the files are not -# properly processed by doxygen. - -INPUT_FILTER = - -# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern -# basis. Doxygen will compare the file name with each pattern and apply the -# filter if there is a match. The filters are a list of the form: pattern=filter -# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how -# filters are used. If the FILTER_PATTERNS tag is empty or if none of the -# patterns match the file name, INPUT_FILTER is applied. -# -# Note that for custom extensions or not directly supported extensions you also -# need to set EXTENSION_MAPPING for the extension otherwise the files are not -# properly processed by doxygen. - -FILTER_PATTERNS = - -# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using -# INPUT_FILTER) will also be used to filter the input files that are used for -# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES). -# The default value is: NO. - -FILTER_SOURCE_FILES = NO - -# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file -# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and -# it is also possible to disable source filtering for a specific pattern using -# *.ext= (so without naming a filter). -# This tag requires that the tag FILTER_SOURCE_FILES is set to YES. - -FILTER_SOURCE_PATTERNS = - -# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that -# is part of the input, its contents will be placed on the main page -# (index.html). This can be useful if you have a project on for instance GitHub -# and want to reuse the introduction page also for the doxygen output. - -USE_MDFILE_AS_MAINPAGE = - -#--------------------------------------------------------------------------- -# Configuration options related to source browsing -#--------------------------------------------------------------------------- - -# If the SOURCE_BROWSER tag is set to YES then a list of source files will be -# generated. Documented entities will be cross-referenced with these sources. -# -# Note: To get rid of all source code in the generated output, make sure that -# also VERBATIM_HEADERS is set to NO. -# The default value is: NO. - -SOURCE_BROWSER = NO - -# Setting the INLINE_SOURCES tag to YES will include the body of functions, -# classes and enums directly into the documentation. -# The default value is: NO. - -INLINE_SOURCES = NO - -# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any -# special comment blocks from generated source code fragments. Normal C, C++ and -# Fortran comments will always remain visible. -# The default value is: YES. - -STRIP_CODE_COMMENTS = YES - -# If the REFERENCED_BY_RELATION tag is set to YES then for each documented -# function all documented functions referencing it will be listed. -# The default value is: NO. - -REFERENCED_BY_RELATION = NO - -# If the REFERENCES_RELATION tag is set to YES then for each documented function -# all documented entities called/used by that function will be listed. -# The default value is: NO. - -REFERENCES_RELATION = NO - -# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set -# to YES then the hyperlinks from functions in REFERENCES_RELATION and -# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will -# link to the documentation. -# The default value is: YES. - -REFERENCES_LINK_SOURCE = YES - -# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the -# source code will show a tooltip with additional information such as prototype, -# brief description and links to the definition and documentation. Since this -# will make the HTML file larger and loading of large files a bit slower, you -# can opt to disable this feature. -# The default value is: YES. -# This tag requires that the tag SOURCE_BROWSER is set to YES. - -SOURCE_TOOLTIPS = YES - -# If the USE_HTAGS tag is set to YES then the references to source code will -# point to the HTML generated by the htags(1) tool instead of doxygen built-in -# source browser. The htags tool is part of GNU's global source tagging system -# (see https://www.gnu.org/software/global/global.html). You will need version -# 4.8.6 or higher. -# -# To use it do the following: -# - Install the latest version of global -# - Enable SOURCE_BROWSER and USE_HTAGS in the config file -# - Make sure the INPUT points to the root of the source tree -# - Run doxygen as normal -# -# Doxygen will invoke htags (and that will in turn invoke gtags), so these -# tools must be available from the command line (i.e. in the search path). -# -# The result: instead of the source browser generated by doxygen, the links to -# source code will now point to the output of htags. -# The default value is: NO. -# This tag requires that the tag SOURCE_BROWSER is set to YES. - -USE_HTAGS = NO - -# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a -# verbatim copy of the header file for each class for which an include is -# specified. Set to NO to disable this. -# See also: Section \class. -# The default value is: YES. - -VERBATIM_HEADERS = YES - -# If the CLANG_ASSISTED_PARSING tag is set to YES then doxygen will use the -# clang parser (see: http://clang.llvm.org/) for more accurate parsing at the -# cost of reduced performance. This can be particularly helpful with template -# rich C++ code for which doxygen's built-in parser lacks the necessary type -# information. -# Note: The availability of this option depends on whether or not doxygen was -# generated with the -Duse-libclang=ON option for CMake. -# The default value is: NO. - -CLANG_ASSISTED_PARSING = NO - -# If clang assisted parsing is enabled you can provide the compiler with command -# line options that you would normally use when invoking the compiler. Note that -# the include paths will already be set by doxygen for the files and directories -# specified with INPUT and INCLUDE_PATH. -# This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES. - -CLANG_OPTIONS = - -# If clang assisted parsing is enabled you can provide the clang parser with the -# path to the compilation database (see: -# http://clang.llvm.org/docs/HowToSetupToolingForLLVM.html) used when the files -# were built. This is equivalent to specifying the "-p" option to a clang tool, -# such as clang-check. These options will then be passed to the parser. -# Note: The availability of this option depends on whether or not doxygen was -# generated with the -Duse-libclang=ON option for CMake. -# The default value is: 0. - -CLANG_COMPILATION_DATABASE_PATH = 0 - -#--------------------------------------------------------------------------- -# Configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- - -# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all -# compounds will be generated. Enable this if the project contains a lot of -# classes, structs, unions or interfaces. -# The default value is: YES. - -ALPHABETICAL_INDEX = YES - -# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in -# which the alphabetical index list will be split. -# Minimum value: 1, maximum value: 20, default value: 5. -# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. - -COLS_IN_ALPHA_INDEX = 5 - -# In case all classes in a project start with a common prefix, all classes will -# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag -# can be used to specify a prefix (or a list of prefixes) that should be ignored -# while generating the index headers. -# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. - -IGNORE_PREFIX = - -#--------------------------------------------------------------------------- -# Configuration options related to the HTML output -#--------------------------------------------------------------------------- - -# If the GENERATE_HTML tag is set to YES, doxygen will generate HTML output -# The default value is: YES. - -GENERATE_HTML = YES - -# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a -# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of -# it. -# The default directory is: html. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_OUTPUT = html - -# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each -# generated HTML page (for example: .htm, .php, .asp). -# The default value is: .html. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_FILE_EXTENSION = .html - -# The HTML_HEADER tag can be used to specify a user-defined HTML header file for -# each generated HTML page. If the tag is left blank doxygen will generate a -# standard header. -# -# To get valid HTML the header file that includes any scripts and style sheets -# that doxygen needs, which is dependent on the configuration options used (e.g. -# the setting GENERATE_TREEVIEW). It is highly recommended to start with a -# default header using -# doxygen -w html new_header.html new_footer.html new_stylesheet.css -# YourConfigFile -# and then modify the file new_header.html. See also section "Doxygen usage" -# for information on how to generate the default header that doxygen normally -# uses. -# Note: The header is subject to change so you typically have to regenerate the -# default header when upgrading to a newer version of doxygen. For a description -# of the possible markers and block names see the documentation. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_HEADER = - -# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each -# generated HTML page. If the tag is left blank doxygen will generate a standard -# footer. See HTML_HEADER for more information on how to generate a default -# footer and what special commands can be used inside the footer. See also -# section "Doxygen usage" for information on how to generate the default footer -# that doxygen normally uses. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_FOOTER = - -# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style -# sheet that is used by each HTML page. It can be used to fine-tune the look of -# the HTML output. If left blank doxygen will generate a default style sheet. -# See also section "Doxygen usage" for information on how to generate the style -# sheet that doxygen normally uses. -# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as -# it is more robust and this tag (HTML_STYLESHEET) will in the future become -# obsolete. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_STYLESHEET = - -# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined -# cascading style sheets that are included after the standard style sheets -# created by doxygen. Using this option one can overrule certain style aspects. -# This is preferred over using HTML_STYLESHEET since it does not replace the -# standard style sheet and is therefore more robust against future updates. -# Doxygen will copy the style sheet files to the output directory. -# Note: The order of the extra style sheet files is of importance (e.g. the last -# style sheet in the list overrules the setting of the previous ones in the -# list). For an example see the documentation. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_EXTRA_STYLESHEET = - -# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or -# other source files which should be copied to the HTML output directory. Note -# that these files will be copied to the base HTML output directory. Use the -# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these -# files. In the HTML_STYLESHEET file, use the file name only. Also note that the -# files will be copied as-is; there are no commands or markers available. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_EXTRA_FILES = - -# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen -# will adjust the colors in the style sheet and background images according to -# this color. Hue is specified as an angle on a colorwheel, see -# https://en.wikipedia.org/wiki/Hue for more information. For instance the value -# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 -# purple, and 360 is red again. -# Minimum value: 0, maximum value: 359, default value: 220. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_COLORSTYLE_HUE = 220 - -# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors -# in the HTML output. For a value of 0 the output will use grayscales only. A -# value of 255 will produce the most vivid colors. -# Minimum value: 0, maximum value: 255, default value: 100. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_COLORSTYLE_SAT = 100 - -# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the -# luminance component of the colors in the HTML output. Values below 100 -# gradually make the output lighter, whereas values above 100 make the output -# darker. The value divided by 100 is the actual gamma applied, so 80 represents -# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not -# change the gamma. -# Minimum value: 40, maximum value: 240, default value: 80. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_COLORSTYLE_GAMMA = 80 - -# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML -# page will contain the date and time when the page was generated. Setting this -# to YES can help to show when doxygen was last run and thus if the -# documentation is up to date. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_TIMESTAMP = NO - -# If the HTML_DYNAMIC_MENUS tag is set to YES then the generated HTML -# documentation will contain a main index with vertical navigation menus that -# are dynamically created via Javascript. If disabled, the navigation index will -# consists of multiple levels of tabs that are statically embedded in every HTML -# page. Disable this option to support browsers that do not have Javascript, -# like the Qt help browser. -# The default value is: YES. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_DYNAMIC_MENUS = YES - -# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML -# documentation will contain sections that can be hidden and shown after the -# page has loaded. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_DYNAMIC_SECTIONS = NO - -# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries -# shown in the various tree structured indices initially; the user can expand -# and collapse entries dynamically later on. Doxygen will expand the tree to -# such a level that at most the specified number of entries are visible (unless -# a fully collapsed tree already exceeds this amount). So setting the number of -# entries 1 will produce a full collapsed tree by default. 0 is a special value -# representing an infinite number of entries and will result in a full expanded -# tree by default. -# Minimum value: 0, maximum value: 9999, default value: 100. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_INDEX_NUM_ENTRIES = 100 - -# If the GENERATE_DOCSET tag is set to YES, additional index files will be -# generated that can be used as input for Apple's Xcode 3 integrated development -# environment (see: https://developer.apple.com/tools/xcode/), introduced with -# OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a -# Makefile in the HTML output directory. Running make will produce the docset in -# that directory and running make install will install the docset in -# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at -# startup. See https://developer.apple.com/tools/creatingdocsetswithdoxygen.html -# for more information. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_DOCSET = NO - -# This tag determines the name of the docset feed. A documentation feed provides -# an umbrella under which multiple documentation sets from a single provider -# (such as a company or product suite) can be grouped. -# The default value is: Doxygen generated docs. -# This tag requires that the tag GENERATE_DOCSET is set to YES. - -DOCSET_FEEDNAME = "Doxygen generated docs" - -# This tag specifies a string that should uniquely identify the documentation -# set bundle. This should be a reverse domain-name style string, e.g. -# com.mycompany.MyDocSet. Doxygen will append .docset to the name. -# The default value is: org.doxygen.Project. -# This tag requires that the tag GENERATE_DOCSET is set to YES. - -DOCSET_BUNDLE_ID = org.doxygen.Project - -# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify -# the documentation publisher. This should be a reverse domain-name style -# string, e.g. com.mycompany.MyDocSet.documentation. -# The default value is: org.doxygen.Publisher. -# This tag requires that the tag GENERATE_DOCSET is set to YES. - -DOCSET_PUBLISHER_ID = org.doxygen.Publisher - -# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher. -# The default value is: Publisher. -# This tag requires that the tag GENERATE_DOCSET is set to YES. - -DOCSET_PUBLISHER_NAME = Publisher - -# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three -# additional HTML index files: index.hhp, index.hhc, and index.hhk. The -# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop -# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on -# Windows. -# -# The HTML Help Workshop contains a compiler that can convert all HTML output -# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML -# files are now used as the Windows 98 help format, and will replace the old -# Windows help format (.hlp) on all Windows platforms in the future. Compressed -# HTML files also contain an index, a table of contents, and you can search for -# words in the documentation. The HTML workshop also contains a viewer for -# compressed HTML files. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_HTMLHELP = NO - -# The CHM_FILE tag can be used to specify the file name of the resulting .chm -# file. You can add a path in front of the file if the result should not be -# written to the html output directory. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -CHM_FILE = - -# The HHC_LOCATION tag can be used to specify the location (absolute path -# including file name) of the HTML help compiler (hhc.exe). If non-empty, -# doxygen will try to run the HTML help compiler on the generated index.hhp. -# The file has to be specified with full path. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -HHC_LOCATION = - -# The GENERATE_CHI flag controls if a separate .chi index file is generated -# (YES) or that it should be included in the master .chm file (NO). -# The default value is: NO. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -GENERATE_CHI = NO - -# The CHM_INDEX_ENCODING is used to encode HtmlHelp index (hhk), content (hhc) -# and project file content. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -CHM_INDEX_ENCODING = - -# The BINARY_TOC flag controls whether a binary table of contents is generated -# (YES) or a normal table of contents (NO) in the .chm file. Furthermore it -# enables the Previous and Next buttons. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -BINARY_TOC = NO - -# The TOC_EXPAND flag can be set to YES to add extra items for group members to -# the table of contents of the HTML help documentation and to the tree view. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -TOC_EXPAND = NO - -# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and -# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that -# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help -# (.qch) of the generated HTML documentation. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_QHP = NO - -# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify -# the file name of the resulting .qch file. The path specified is relative to -# the HTML output folder. -# This tag requires that the tag GENERATE_QHP is set to YES. - -QCH_FILE = - -# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help -# Project output. For more information please see Qt Help Project / Namespace -# (see: http://doc.qt.io/qt-4.8/qthelpproject.html#namespace). -# The default value is: org.doxygen.Project. -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_NAMESPACE = org.doxygen.Project - -# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt -# Help Project output. For more information please see Qt Help Project / Virtual -# Folders (see: http://doc.qt.io/qt-4.8/qthelpproject.html#virtual-folders). -# The default value is: doc. -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_VIRTUAL_FOLDER = doc - -# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom -# filter to add. For more information please see Qt Help Project / Custom -# Filters (see: http://doc.qt.io/qt-4.8/qthelpproject.html#custom-filters). -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_CUST_FILTER_NAME = - -# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the -# custom filter to add. For more information please see Qt Help Project / Custom -# Filters (see: http://doc.qt.io/qt-4.8/qthelpproject.html#custom-filters). -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_CUST_FILTER_ATTRS = - -# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this -# project's filter section matches. Qt Help Project / Filter Attributes (see: -# http://doc.qt.io/qt-4.8/qthelpproject.html#filter-attributes). -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_SECT_FILTER_ATTRS = - -# The QHG_LOCATION tag can be used to specify the location of Qt's -# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the -# generated .qhp file. -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHG_LOCATION = - -# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be -# generated, together with the HTML files, they form an Eclipse help plugin. To -# install this plugin and make it available under the help contents menu in -# Eclipse, the contents of the directory containing the HTML and XML files needs -# to be copied into the plugins directory of eclipse. The name of the directory -# within the plugins directory should be the same as the ECLIPSE_DOC_ID value. -# After copying Eclipse needs to be restarted before the help appears. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_ECLIPSEHELP = NO - -# A unique identifier for the Eclipse help plugin. When installing the plugin -# the directory name containing the HTML and XML files should also have this -# name. Each documentation set should have its own identifier. -# The default value is: org.doxygen.Project. -# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES. - -ECLIPSE_DOC_ID = org.doxygen.Project - -# If you want full control over the layout of the generated HTML pages it might -# be necessary to disable the index and replace it with your own. The -# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top -# of each HTML page. A value of NO enables the index and the value YES disables -# it. Since the tabs in the index contain the same information as the navigation -# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -DISABLE_INDEX = NO - -# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index -# structure should be generated to display hierarchical information. If the tag -# value is set to YES, a side panel will be generated containing a tree-like -# index structure (just like the one that is generated for HTML Help). For this -# to work a browser that supports JavaScript, DHTML, CSS and frames is required -# (i.e. any modern browser). Windows users are probably better off using the -# HTML help feature. Via custom style sheets (see HTML_EXTRA_STYLESHEET) one can -# further fine-tune the look of the index. As an example, the default style -# sheet generated by doxygen has an example that shows how to put an image at -# the root of the tree instead of the PROJECT_NAME. Since the tree basically has -# the same information as the tab index, you could consider setting -# DISABLE_INDEX to YES when enabling this option. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_TREEVIEW = NO - -# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that -# doxygen will group on one line in the generated HTML documentation. -# -# Note that a value of 0 will completely suppress the enum values from appearing -# in the overview section. -# Minimum value: 0, maximum value: 20, default value: 4. -# This tag requires that the tag GENERATE_HTML is set to YES. - -ENUM_VALUES_PER_LINE = 4 - -# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used -# to set the initial width (in pixels) of the frame in which the tree is shown. -# Minimum value: 0, maximum value: 1500, default value: 250. -# This tag requires that the tag GENERATE_HTML is set to YES. - -TREEVIEW_WIDTH = 250 - -# If the EXT_LINKS_IN_WINDOW option is set to YES, doxygen will open links to -# external symbols imported via tag files in a separate window. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -EXT_LINKS_IN_WINDOW = NO - -# Use this tag to change the font size of LaTeX formulas included as images in -# the HTML documentation. When you change the font size after a successful -# doxygen run you need to manually remove any form_*.png images from the HTML -# output directory to force them to be regenerated. -# Minimum value: 8, maximum value: 50, default value: 10. -# This tag requires that the tag GENERATE_HTML is set to YES. - -FORMULA_FONTSIZE = 10 - -# Use the FORMULA_TRANSPARENT tag to determine whether or not the images -# generated for formulas are transparent PNGs. Transparent PNGs are not -# supported properly for IE 6.0, but are supported on all modern browsers. -# -# Note that when changing this option you need to delete any form_*.png files in -# the HTML output directory before the changes have effect. -# The default value is: YES. -# This tag requires that the tag GENERATE_HTML is set to YES. - -FORMULA_TRANSPARENT = YES - -# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see -# https://www.mathjax.org) which uses client side Javascript for the rendering -# instead of using pre-rendered bitmaps. Use this if you do not have LaTeX -# installed or if you want to formulas look prettier in the HTML output. When -# enabled you may also need to install MathJax separately and configure the path -# to it using the MATHJAX_RELPATH option. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -USE_MATHJAX = NO - -# When MathJax is enabled you can set the default output format to be used for -# the MathJax output. See the MathJax site (see: -# http://docs.mathjax.org/en/latest/output.html) for more details. -# Possible values are: HTML-CSS (which is slower, but has the best -# compatibility), NativeMML (i.e. MathML) and SVG. -# The default value is: HTML-CSS. -# This tag requires that the tag USE_MATHJAX is set to YES. - -MATHJAX_FORMAT = HTML-CSS - -# When MathJax is enabled you need to specify the location relative to the HTML -# output directory using the MATHJAX_RELPATH option. The destination directory -# should contain the MathJax.js script. For instance, if the mathjax directory -# is located at the same level as the HTML output directory, then -# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax -# Content Delivery Network so you can quickly see the result without installing -# MathJax. However, it is strongly recommended to install a local copy of -# MathJax from https://www.mathjax.org before deployment. -# The default value is: https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/. -# This tag requires that the tag USE_MATHJAX is set to YES. - -MATHJAX_RELPATH = https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/ - -# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax -# extension names that should be enabled during MathJax rendering. For example -# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols -# This tag requires that the tag USE_MATHJAX is set to YES. - -MATHJAX_EXTENSIONS = - -# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces -# of code that will be used on startup of the MathJax code. See the MathJax site -# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an -# example see the documentation. -# This tag requires that the tag USE_MATHJAX is set to YES. - -MATHJAX_CODEFILE = - -# When the SEARCHENGINE tag is enabled doxygen will generate a search box for -# the HTML output. The underlying search engine uses javascript and DHTML and -# should work on any modern browser. Note that when using HTML help -# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) -# there is already a search function so this one should typically be disabled. -# For large projects the javascript based search engine can be slow, then -# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to -# search using the keyboard; to jump to the search box use + S -# (what the is depends on the OS and browser, but it is typically -# , /