From commits-return-118857-archive-asf-public=cust-asf.ponee.io@ignite.apache.org Thu Jun 28 16:42:43 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 6796E1807A1 for ; Thu, 28 Jun 2018 16:42:40 +0200 (CEST) Received: (qmail 1399 invoked by uid 500); 28 Jun 2018 14:42:34 -0000 Mailing-List: contact commits-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.apache.org Delivered-To: mailing list commits@ignite.apache.org Received: (qmail 897 invoked by uid 99); 28 Jun 2018 14:42:33 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 28 Jun 2018 14:42:33 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 6B99DE1198; Thu, 28 Jun 2018 14:42:33 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: isapego@apache.org To: commits@ignite.apache.org Date: Thu, 28 Jun 2018 14:42:55 -0000 Message-Id: In-Reply-To: <572ab24feb37490987fb9c207fa56692@git.apache.org> References: <572ab24feb37490987fb9c207fa56692@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [24/29] ignite git commit: IGNITE-7777: Implemented Ignite NodeJs thin client http://git-wip-us.apache.org/repos/asf/ignite/blob/c56d16fb/modules/platforms/nodejs/api_spec/ComplexObjectType.html ---------------------------------------------------------------------- diff --git a/modules/platforms/nodejs/api_spec/ComplexObjectType.html b/modules/platforms/nodejs/api_spec/ComplexObjectType.html new file mode 100644 index 0000000..09cdd2a --- /dev/null +++ b/modules/platforms/nodejs/api_spec/ComplexObjectType.html @@ -0,0 +1,526 @@ + + + + + JSDoc: Class: ComplexObjectType + + + + + + + + + + +
+ +

Class: ComplexObjectType

+ + + + + + +
+ +
+ +

ComplexObjectType(jsObject, typeNameopt)

+ +

Class representing a complex type of Ignite object.

+

It is described by COMPOSITE_TYPE.COMPLEX_OBJECT ObjectType.COMPOSITE_TYPE, +by a name of the complex type and by a JavaScript Object which is mapped to/from the Ignite complex type.

+ + +
+ +
+
+ + + + +

Constructor

+ + + +

new ComplexObjectType(jsObject, typeNameopt)

+ + + + + + +
+

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 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.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDefaultDescription
jsObject + + +object + + + + + + + + + + + +

instance of JavaScript Object which will be mapped to/from this complex type.

typeName + + +string + + + + + + <optional>
+ + + + + +
+ + null + +

name of the complex type.

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + +

Extends

+ + + + + + + + + + + + + + + + + + + + + + +

Methods

+ + + + + + + +

setFieldType(fieldName, fieldType) → {ComplexObjectType}

+ + + + + + +
+

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 ObjectType class.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
fieldName + + +string + + + +

name of the field.

fieldType + + +ObjectType.PRIMITIVE_TYPE +| + +CompositeType + + + +

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).
  • +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

if error.

+
+
+
+
+
+
+ Type +
+
+ +IgniteClientError + + +
+
+
+
+
+ + + + + +
Returns:
+ + +
+
    +
  • the same instance of the ComplexObjectType.
  • +
+
+ + + +
+
+ Type +
+
+ +ComplexObjectType + + +
+
+ + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 3.5.5 on Tue May 22 2018 12:08:49 GMT+0300 (Russia TZ 2 Standard Time) +
+ + + + + \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/c56d16fb/modules/platforms/nodejs/api_spec/CompositeType.html ---------------------------------------------------------------------- diff --git a/modules/platforms/nodejs/api_spec/CompositeType.html b/modules/platforms/nodejs/api_spec/CompositeType.html new file mode 100644 index 0000000..a870b0c --- /dev/null +++ b/modules/platforms/nodejs/api_spec/CompositeType.html @@ -0,0 +1,170 @@ + + + + + JSDoc: Class: CompositeType + + + + + + + + + + +
+ +

Class: CompositeType

+ + + + + + +
+ +
+ +

CompositeType

+ +

Base class representing a non-primitive (composite) type of Ignite object.

+

The class has no public constructor. Only subclasses may be instantiated.

+ + +
+ +
+
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + +

Extends

+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 3.5.5 on Tue May 22 2018 12:08:49 GMT+0300 (Russia TZ 2 Standard Time) +
+ + + + + \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/c56d16fb/modules/platforms/nodejs/api_spec/Cursor.html ---------------------------------------------------------------------- diff --git a/modules/platforms/nodejs/api_spec/Cursor.html b/modules/platforms/nodejs/api_spec/Cursor.html new file mode 100644 index 0000000..da75149 --- /dev/null +++ b/modules/platforms/nodejs/api_spec/Cursor.html @@ -0,0 +1,588 @@ + + + + + JSDoc: Class: Cursor + + + + + + + + + + +
+ +

Class: Cursor

+ + + + + + +
+ +
+ +

Cursor

+ +

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 CacheClient objects. +One instance of this class returns results of one SQL or Scan query operation.

+ + +
+ +
+
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +

Methods

+ + + + + + + +

(async) close()

+ + + + + + +
+

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.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +

(async) getAll() → {Promise.<Array.<CacheEntry>>}

+ + + + + + +
+

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.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+
    +
  • all cache entries (key-value pairs) +returned by SQL or Scan query.
  • +
+
+ + + +
+
+ Type +
+
+ +Promise.<Array.<CacheEntry>> + + +
+
+ + + + + + + + + + + + + +

(async) getValue() → {Promise.<CacheEntry>}

+ + + + + + +
+

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.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+
    +
  • a cache entry (key-value pair).
  • +
+
+ + + +
+
+ Type +
+
+ +Promise.<CacheEntry> + + +
+
+ + + + + + + + + + + + + +

hasMore() → {boolean}

+ + + + + + +
+

Checks if more elements are available in the query results.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+
    +
  • true if more cache entries are available, false otherwise.
  • +
+
+ + + +
+
+ Type +
+
+ +boolean + + +
+
+ + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 3.5.5 on Tue May 22 2018 12:08:49 GMT+0300 (Russia TZ 2 Standard Time) +
+ + + + + \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/c56d16fb/modules/platforms/nodejs/api_spec/Cursor.js.html ---------------------------------------------------------------------- diff --git a/modules/platforms/nodejs/api_spec/Cursor.js.html b/modules/platforms/nodejs/api_spec/Cursor.js.html new file mode 100644 index 0000000..b73fa97 --- /dev/null +++ b/modules/platforms/nodejs/api_spec/Cursor.js.html @@ -0,0 +1,360 @@ + + + + + JSDoc: Source: Cursor.js + + + + + + + + + + +
+ +

Source: Cursor.js

+ + + + + + +
+
+
/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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');
+const BinaryReader = require('./internal/BinaryReader');
+const BinaryWriter = require('./internal/BinaryWriter');
+
+/**
+ * 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<CacheEntry>} - 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<Array<CacheEntry>>} - 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._socket.send(
+                BinaryUtils.OPERATION.RESOURCE_CLOSE,
+                async (payload) => {
+                    await this._write(payload);
+                });
+        }
+    }
+
+    /** Private methods */
+
+    /**
+     * @ignore
+     */
+    constructor(socket, operation, buffer, keyType = null, valueType = null) {
+        this._socket = socket;
+        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._socket.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 BinaryReader.readObject(buffer, this._keyType),
+            await BinaryReader.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<*>>} - 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<Array<Array<*>>>} - 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<string>} - 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(socket, buffer) {
+        super(socket, 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 BinaryReader.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 BinaryReader.readObject(buffer);
+        }
+        return values;
+    }
+}
+
+module.exports.Cursor = Cursor;
+module.exports.SqlFieldsCursor = SqlFieldsCursor;
+
+
+
+ + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 3.5.5 on Tue May 22 2018 12:08:48 GMT+0300 (Russia TZ 2 Standard Time) +
+ + + + + http://git-wip-us.apache.org/repos/asf/ignite/blob/c56d16fb/modules/platforms/nodejs/api_spec/EnumItem.html ---------------------------------------------------------------------- diff --git a/modules/platforms/nodejs/api_spec/EnumItem.html b/modules/platforms/nodejs/api_spec/EnumItem.html new file mode 100644 index 0000000..9697520 --- /dev/null +++ b/modules/platforms/nodejs/api_spec/EnumItem.html @@ -0,0 +1,1431 @@ + + + + + JSDoc: Class: EnumItem + + + + + + + + + + +
+ +

Class: EnumItem

+ + + + + + +
+ +
+ +

EnumItem(typeId)

+ +

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.

+ + +
+ +
+
+ + + + +

Constructor

+ + + +

new EnumItem(typeId)

+ + + + + + +
+

Public constructor.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
typeId + + +number + + + +

Id of the Ignite enum type.

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +

Methods

+ + + + + + + +

getName() → {string}

+ + + + + + +
+

Returns name of the item +or null if name is not set.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+
    +
  • name of the item.
  • +
+
+ + + +
+
+ Type +
+
+ +string + + +
+
+ + + + + + + + + + + + + +

getOrdinal() → {number}

+ + + + + + +
+

Returns ordinal of the item in the Ignite enum type +or null if ordinal is not set.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+
    +
  • ordinal of the item in the Ignite enum type.
  • +
+
+ + + +
+
+ Type +
+
+ +number + + +
+
+ + + + + + + + + + + + + +

getTypeId() → {number}

+ + + + + + +
+

Returns Id of the Ignite enum type.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+
    +
  • Id of the enum type.
  • +
+
+ + + +
+
+ Type +
+
+ +number + + +
+
+ + + + + + + + + + + + + +

getValue() → {number}

+ + + + + + +
+

Returns value of the item +or null if value is not set.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+
    +
  • value of the item.
  • +
+
+ + + +
+
+ Type +
+
+ +number + + +
+
+ + + + + + + + + + + + + +

setName(name) → {EnumItem}

+ + + + + + +
+

Sets or updates name of the item.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
name + + +string + + + +

name of the item.

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

if error.

+
+
+
+
+
+
+ Type +
+
+ +IgniteClientError + + +
+
+
+
+
+ + + + + +
Returns:
+ + +
+
    +
  • the same instance of EnumItem
  • +
+
+ + + +
+
+ Type +
+
+ +EnumItem + + +
+
+ + + + + + + + + + + + + +

setOrdinal(ordinal) → {EnumItem}

+ + + + + + +
+

Sets or updates ordinal of the item in the Ignite enum type.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
ordinal + + +number + + + +

ordinal of the item in the Ignite enum type.

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

if error.

+
+
+
+
+
+
+ Type +
+
+ +IgniteClientError + + +
+
+
+
+
+ + + + + +
Returns:
+ + +
+
    +
  • the same instance of EnumItem
  • +
+
+ + + +
+
+ Type +
+
+ +EnumItem + + +
+
+ + + + + + + + + + + + + +

setTypeId(typeId) → {EnumItem}

+ + + + + + +
+

Updates Id of the Ignite enum type.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
typeId + + +number + + + +

new Id of the Ignite enum type.

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

if error.

+
+
+
+
+
+
+ Type +
+
+ +IgniteClientError + + +
+
+
+
+
+ + + + + +
Returns:
+ + +
+
    +
  • the same instance of EnumItem
  • +
+
+ + + +
+
+ Type +
+
+ +EnumItem + + +
+
+ + + + + + + + + + + + + +

setValue(value) → {EnumItem}

+ + + + + + +
+

Sets or updates value of the item.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
value + + +number + + + +

value of the item.

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Throws:
+ + + +
+
+
+

if error.

+
+
+
+
+
+
+ Type +
+
+ +IgniteClientError + + +
+
+
+
+
+ + + + + +
Returns:
+ + +
+
    +
  • the same instance of EnumItem
  • +
+
+ + + +
+
+ Type +
+
+ +EnumItem + + +
+
+ + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 3.5.5 on Tue May 22 2018 12:08:49 GMT+0300 (Russia TZ 2 Standard Time) +
+ + + + + \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/c56d16fb/modules/platforms/nodejs/api_spec/EnumItem.js.html ---------------------------------------------------------------------- diff --git a/modules/platforms/nodejs/api_spec/EnumItem.js.html b/modules/platforms/nodejs/api_spec/EnumItem.js.html new file mode 100644 index 0000000..99bb5ae --- /dev/null +++ b/modules/platforms/nodejs/api_spec/EnumItem.js.html @@ -0,0 +1,255 @@ + + + + + JSDoc: Source: EnumItem.js + + + + + + + + + + +
+ +

Source: EnumItem.js

+ + + + + + +
+
+
/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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');
+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(buffer) {
+        buffer.writeInteger(this._typeId);
+        if (this._ordinal !== null) {
+            buffer.writeInteger(this._ordinal);
+            return;
+        }
+        else if (this._name !== null || this._value !== null) {
+            const type = await this._getType(this._typeId);
+            if (type._isEnum && 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(buffer) {
+        this._typeId = buffer.readInteger();
+        this._ordinal = buffer.readInteger();
+        const type = await this._getType(this._typeId);
+        if (!type._isEnum || !type._enumValues || type._enumValues.length <= this._ordinal) {
+            throw new Errors.IgniteClientError('EnumItem can not be deserialized: type mismatch');
+        }
+        this._name = type._enumValues[this._ordinal][0];
+        this._value = type._enumValues[this._ordinal][1];
+    }
+
+    /**
+     * @ignore
+     */
+    async _getType(typeId) {
+        const BinaryTypeStorage = require('./internal/BinaryTypeStorage');
+        return await BinaryTypeStorage.getEntity().getType(typeId);
+    }
+}
+
+module.exports = EnumItem;
+
+
+
+ + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 3.5.5 on Tue May 22 2018 12:08:48 GMT+0300 (Russia TZ 2 Standard Time) +
+ + + + + http://git-wip-us.apache.org/repos/asf/ignite/blob/c56d16fb/modules/platforms/nodejs/api_spec/Errors.js.html ---------------------------------------------------------------------- diff --git a/modules/platforms/nodejs/api_spec/Errors.js.html b/modules/platforms/nodejs/api_spec/Errors.js.html new file mode 100644 index 0000000..220d2e8 --- /dev/null +++ b/modules/platforms/nodejs/api_spec/Errors.js.html @@ -0,0 +1,172 @@ + + + + + JSDoc: Source: Errors.js + + + + + + + + + + +
+ +

Source: Errors.js

+ + + + + + +
+
+
/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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);
+    }
+}
+
+/**
+ * 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;
+
+
+
+ + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 3.5.5 on Tue May 22 2018 12:08:48 GMT+0300 (Russia TZ 2 Standard Time) +
+ + + + +