Constructor
new IgniteClient(onStateChangedopt)
Public constructor.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
onStateChanged |
IgniteClient.onStateChanged |
<optional> |
null | callback called everytime when the client has moved to a new state IgniteClient.STATE. |
- Source:
Members
(static, readonly) STATE
State of Ignite client.
Properties:
Name | Type | Description |
---|---|---|
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. |
|
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. |
|
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. |
- Source:
Methods
(async) cacheNames() → {Promise.<Array.<string>>}
Gets existing cache names.
- Source:
Throws:
-
-
if the client is not in CONNECTED IgniteClient.STATE.
- Type
- IllegalStateError
-
-
-
if other error.
- Type
- IgniteClientError
-
Returns:
- array with the existing cache names. The array is empty if no caches exist.
- Type
- Promise.<Array.<string>>
(async) connect(config)
Connects the client.
Should be called from DISCONNECTED state only. Moves the client to CONNECTING state.
Parameters:
Name | Type | Description |
---|---|---|
config |
IgniteClientConfiguration | the client configuration. |
- Source:
Throws:
-
-
if the client is not in DISCONNECTED IgniteClient.STATE.
- Type
- IllegalStateError
-
-
-
if other error.
- Type
- IgniteClientError
-
(async) createCache(name, cacheConfigopt) → {Promise.<CacheClient>}
Creates new cache with the provided name and optional configuration.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
name |
string | cache name. |
||
cacheConfig |
CacheConfiguration |
<optional> |
null | cache configuration. |
- Source:
Throws:
-
-
if the client is not in CONNECTED IgniteClient.STATE.
- Type
- IllegalStateError
-
-
-
if cache with the provided name already exists.
- Type
- OperationError
-
-
-
if other error.
- Type
- IgniteClientError
-
Returns:
- new cache client instance for the created cache.
- Type
- Promise.<CacheClient>
(async) destroyCache(name)
Destroys cache with the provided name.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | cache name. |
- Source:
Throws:
-
-
if the client is not in CONNECTED IgniteClient.STATE.
- Type
- IllegalStateError
-
-
-
if cache with the provided name does not exist.
- Type
- OperationError
-
-
-
if other error.
- Type
- IgniteClientError
-
disconnect()
Disconnects the client.
Moves the client to DISCONNECTED state from any other state. Does nothing if the client already disconnected.
- Source:
getCache(name) → {CacheClient}
Gets cache client instance of cache with the provided name. The method does not check if the cache with the provided name exists.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | cache name. |
- Source:
Throws:
-
if error.
- Type
- IgniteClientError
Returns:
- new cache client instance.
- Type
- CacheClient
(async) getCacheConfiguration(name) → {Promise.<CacheConfiguration>}
Returns configuration of cache with the provided name.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | cache name. |
- Source:
Throws:
-
-
if the client is not in CONNECTED IgniteClient.STATE.
- Type
- IllegalStateError
-
-
-
if cache with the provided name does not exist.
- Type
- OperationError
-
-
-
if other error.
- Type
- IgniteClientError
-
Returns:
- cache configuration
- Type
- Promise.<CacheConfiguration>
(async) getOrCreateCache(name, cacheConfigopt) → {Promise.<CacheClient>}
Gets existing cache with the provided name or creates new one with the provided name and optional configuration.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
name |
string | cache name. |
||
cacheConfig |
CacheConfiguration |
<optional> |
null | cache configuration (ignored if cache with the provided name already exists). |
- Source:
Throws:
-
-
if the client is not in CONNECTED IgniteClient.STATE.
- Type
- IllegalStateError
-
-
-
if other error.
- Type
- IgniteClientError
-
Returns:
- new cache client instance for the existing or created cache.
- Type
- Promise.<CacheClient>
setDebug(value)
Enables/disables the library debug output (including errors logging). Disabled by default.
Parameters:
Name | Type | Description |
---|---|---|
value |
boolean | true to enable, false to disable |
- Source:
Type Definitions
onStateChanged(state, reason)
onStateChanged callback.
Parameters:
Name | Type | Description |
---|---|---|
state |
IgniteClient.STATE | the new state of the client. |
reason |
string | the reason why the state has been changed. |
- Source: