infinispan 0.9.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/documentation/asciidoc/stories/assembly_client_usage_examples.adoc +2 -8
- package/documentation/asciidoc/stories/{assembly_configuration.adoc → assembly_installation_configuration.adoc} +6 -4
- package/documentation/asciidoc/titles/js_client.asciidoc +1 -0
- package/documentation/asciidoc/titles/stories.adoc +1 -2
- package/documentation/asciidoc/topics/attributes/community-attributes.adoc +1 -1
- package/documentation/asciidoc/topics/attributes/downstream-attributes.adoc +0 -2
- package/documentation/asciidoc/topics/code_examples/authentication-digest.js +3 -2
- package/documentation/asciidoc/topics/code_examples/authentication-external.js +3 -2
- package/documentation/asciidoc/topics/code_examples/authentication-oauthbearer.js +3 -2
- package/documentation/asciidoc/topics/code_examples/authentication-plain.js +3 -2
- package/documentation/asciidoc/topics/code_examples/authentication-scram.js +3 -2
- package/documentation/asciidoc/topics/code_examples/await-single-entries.js +1 -1
- package/documentation/asciidoc/topics/code_examples/conditional-operations.js +7 -1
- package/documentation/asciidoc/topics/code_examples/connection-multiple-servers.js +5 -1
- package/documentation/asciidoc/topics/code_examples/data-types.js +2 -2
- package/documentation/asciidoc/topics/code_examples/ephemeral-data.js +11 -6
- package/documentation/asciidoc/topics/code_examples/hello-world.js +13 -1
- package/documentation/asciidoc/topics/code_examples/key-value-converter.js +3 -4
- package/documentation/asciidoc/topics/code_examples/multiple-entries.js +13 -2
- package/documentation/asciidoc/topics/code_examples/register-event-listener.js +8 -4
- package/documentation/asciidoc/topics/code_examples/sample-script-execute.js +6 -1
- package/documentation/asciidoc/topics/code_examples/single-entries.js +13 -2
- package/documentation/asciidoc/topics/proc_configuring_connections.adoc +8 -9
- package/documentation/asciidoc/topics/proc_installing_clients.adoc +23 -5
- package/documentation/asciidoc/topics/ref_client_usage.adoc +116 -0
- package/lib/codec.js +153 -2
- package/lib/infinispan.js +27 -1
- package/lib/io.js +14 -8
- package/lib/protocols.js +129 -4
- package/lib/protostream/message-wrapping.proto +134 -0
- package/lib/protostream/query.proto +122 -0
- package/lib/sasl/bitops.js +5 -7
- package/lib/sasl/factory.js +71 -0
- package/lib/utils.js +1 -1
- package/memory-profiling/helper.js +9 -0
- package/memory-profiling/infinispan_memory_many_get.js +1 -3
- package/memory-profiling/infinispan_memory_one_get.js +6 -4
- package/package.json +7 -12
- package/run-servers.sh +1 -1
- package/spec/codec_spec.js +7 -7
- package/spec/configs/infinispan-clustered.xml +17 -14
- package/spec/configs/infinispan-ssl.xml +25 -22
- package/spec/configs/infinispan-xsite-EARTH.xml +17 -14
- package/spec/configs/infinispan-xsite-MOON.xml +14 -11
- package/spec/configs/infinispan.xml +22 -13
- package/spec/protostream_spec.js +237 -0
- package/spec/utils/testing.js +1 -3
- package/documentation/asciidoc/stories/assembly_getting_started.adoc +0 -11
- package/documentation/asciidoc/topics/community-attributes.adoc +0 -10
- package/documentation/asciidoc/topics/downstream-attributes.adoc +0 -10
- package/documentation/asciidoc/topics/proc_executing_scripts.adoc +0 -16
- package/documentation/asciidoc/topics/proc_registering_event_listeners.adoc +0 -31
- package/documentation/asciidoc/topics/proc_using_async_await.adoc +0 -23
- package/documentation/asciidoc/topics/proc_using_conditional_operations.adoc +0 -7
- package/documentation/asciidoc/topics/proc_working_ephemeral_data.adoc +0 -7
- package/documentation/asciidoc/topics/proc_working_multiple_entries.adoc +0 -7
- package/documentation/asciidoc/topics/proc_working_single_entries_statistics.adoc +0 -7
- package/documentation/asciidoc/topics/ref_basic_usage.adoc +0 -8
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
<infinispan
|
|
2
2
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
3
|
-
xsi:schemaLocation="urn:infinispan:config:
|
|
4
|
-
urn:infinispan:server:
|
|
5
|
-
xmlns="urn:infinispan:config:
|
|
6
|
-
xmlns:server="urn:infinispan:server:
|
|
3
|
+
xsi:schemaLocation="urn:infinispan:config:13.0 https://infinispan.org/schemas/infinispan-config-13.0.xsd
|
|
4
|
+
urn:infinispan:server:13.0 https://infinispan.org/schemas/infinispan-server-13.0.xsd"
|
|
5
|
+
xmlns="urn:infinispan:config:13.0"
|
|
6
|
+
xmlns:server="urn:infinispan:server:13.0">
|
|
7
7
|
|
|
8
8
|
<cache-container name="default" statistics="true" default-cache="default">
|
|
9
9
|
<!-- <security>-->
|
|
10
10
|
<!-- <authorization/>-->
|
|
11
11
|
<!-- </security>-->
|
|
12
|
+
<metrics accurate-size="true"/>
|
|
12
13
|
<local-cache name="default">
|
|
13
14
|
<locking acquire-timeout="30000" concurrency-level="1000" />
|
|
14
15
|
<encoding media-type="text/plain"/>
|
|
@@ -23,9 +24,15 @@
|
|
|
23
24
|
<local-cache name="jsonCache">
|
|
24
25
|
<encoding media-type="text/plain"/>
|
|
25
26
|
</local-cache>
|
|
27
|
+
<local-cache name="protoStreamCache">
|
|
28
|
+
<encoding>
|
|
29
|
+
<key media-type="text/plain"/>
|
|
30
|
+
<value media-type="application/x-protostream"/>
|
|
31
|
+
</encoding>
|
|
32
|
+
</local-cache>
|
|
26
33
|
</cache-container>
|
|
27
34
|
|
|
28
|
-
<server xmlns="urn:infinispan:server:
|
|
35
|
+
<server xmlns="urn:infinispan:server:13.0">
|
|
29
36
|
<interfaces>
|
|
30
37
|
<interface name="public">
|
|
31
38
|
<inet-address value="${infinispan.bind.address:127.0.0.1}"/>
|
|
@@ -55,14 +62,16 @@
|
|
|
55
62
|
</security-realms>
|
|
56
63
|
</security>
|
|
57
64
|
|
|
58
|
-
|
|
59
|
-
<
|
|
60
|
-
<
|
|
61
|
-
<
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
65
|
+
<endpoints>
|
|
66
|
+
<endpoint socket-binding="default" security-realm="default">
|
|
67
|
+
<hotrod-connector name="hotrod">
|
|
68
|
+
<authentication>
|
|
69
|
+
<sasl mechanisms="PLAIN DIGEST-MD5 SCRAM-SHA-1 SCRAM-SHA-256 SCRAM-SHA-384 SCRAM-SHA-512"
|
|
70
|
+
server-name="infinispan"/>
|
|
71
|
+
</authentication>
|
|
72
|
+
</hotrod-connector>
|
|
73
|
+
<rest-connector name="rest"/>
|
|
74
|
+
</endpoint>
|
|
66
75
|
</endpoints>
|
|
67
76
|
</server>
|
|
68
77
|
</infinispan>
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
//'use strict';
|
|
2
|
+
|
|
3
|
+
var _ = require('underscore');
|
|
4
|
+
var path = require('path');
|
|
5
|
+
var long = require('long');
|
|
6
|
+
|
|
7
|
+
var t = require('./utils/testing'); // Testing dependency
|
|
8
|
+
var protobuf = require('protobufjs');
|
|
9
|
+
const { iteratee } = require('underscore');
|
|
10
|
+
var ispn = require('../lib/infinispan');
|
|
11
|
+
|
|
12
|
+
var myMsg = `package awesomepackage;
|
|
13
|
+
syntax = "proto3";
|
|
14
|
+
/**
|
|
15
|
+
* @TypeId(1000043)
|
|
16
|
+
*/
|
|
17
|
+
message AwesomeMessage {
|
|
18
|
+
string awesome_field = 1;
|
|
19
|
+
}`
|
|
20
|
+
|
|
21
|
+
var myMsg2 = `package awesomepackage;
|
|
22
|
+
/**
|
|
23
|
+
* @TypeId(1000043)
|
|
24
|
+
*/
|
|
25
|
+
message AwesomeMessage {
|
|
26
|
+
required string awesome_field = 1;
|
|
27
|
+
}`
|
|
28
|
+
|
|
29
|
+
var myMsg3 = `package awesomepackage;
|
|
30
|
+
/**
|
|
31
|
+
* @TypeId(1000044)
|
|
32
|
+
*/
|
|
33
|
+
message AwesomeUser {
|
|
34
|
+
required string name = 1;
|
|
35
|
+
required int64 age = 2;
|
|
36
|
+
required bool isVerified =3;
|
|
37
|
+
}`
|
|
38
|
+
|
|
39
|
+
var p30 = t.protocol30({
|
|
40
|
+
dataFormat: {
|
|
41
|
+
keyType: 'text/plain',
|
|
42
|
+
valueType: 'application/x-protostream'
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
describe('Protobuf encoding', function () {
|
|
47
|
+
var expectedArray = [0x0a, 0x0d, 0x41, 0x77, 0x65, 0x73, 0x6f, 0x6d, 0x65, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67];
|
|
48
|
+
var expectedBuffer = Buffer.from(expectedArray);
|
|
49
|
+
it("Encodes a proto message", function () {
|
|
50
|
+
root = protobuf.parse(myMsg).root;
|
|
51
|
+
|
|
52
|
+
// Obtain a message type
|
|
53
|
+
var AwesomeMessage = root.lookupType(".awesomepackage.AwesomeMessage");
|
|
54
|
+
var payload = { awesomeField: "AwesomeString" };
|
|
55
|
+
var errMsg = AwesomeMessage.verify(payload);
|
|
56
|
+
expect(errMsg === null).toBeTruthy();
|
|
57
|
+
var message = AwesomeMessage.create(payload); // or use .fromObject if conversion is necessary
|
|
58
|
+
var buffer = AwesomeMessage.encode(message).finish();
|
|
59
|
+
expect(Buffer.compare(buffer, expectedBuffer)).toBe(0);
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
describe('Protostream encoding', function () {
|
|
65
|
+
p30.registerProtostreamType(".awesomepackage.AwesomeMessage", 1000043);
|
|
66
|
+
|
|
67
|
+
it("Returns the Protostream type", function () {
|
|
68
|
+
var psType = p30.lookupProtostreamTypeByName(".awesomepackage.AwesomeMessage");
|
|
69
|
+
expect(psType).toBe(1000043);
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
it("Encodes a Protostream message", function () {
|
|
73
|
+
root = protobuf.parse(myMsg).root;
|
|
74
|
+
protobuf.loadSync(path.join(__dirname + '/../lib/protostream/message-wrapping.proto'), root);
|
|
75
|
+
// Obtain message types
|
|
76
|
+
var AwesomeMessage = root.lookupType(".awesomepackage.AwesomeMessage");
|
|
77
|
+
var WrappedMessage = root.lookupType(".org.infinispan.protostream.WrappedMessage");
|
|
78
|
+
// Build input message
|
|
79
|
+
var payload = { awesomeField: "AwesomeString" };
|
|
80
|
+
var errMsg = AwesomeMessage.verify(payload);
|
|
81
|
+
expect(errMsg === null).toBeTruthy();
|
|
82
|
+
var message = AwesomeMessage.create(payload);
|
|
83
|
+
// Build manually WrappedMessage
|
|
84
|
+
var buffer = AwesomeMessage.encode(message).finish();
|
|
85
|
+
var wmPayload = {
|
|
86
|
+
wrappedMessage: buffer,
|
|
87
|
+
wrappedTypeId: 1000043
|
|
88
|
+
};
|
|
89
|
+
errMsg = WrappedMessage.verify(wmPayload);
|
|
90
|
+
expect(errMsg === null).toBeTruthy();
|
|
91
|
+
var wmMessage = WrappedMessage.create(wmPayload);
|
|
92
|
+
var expectedWMBuffer = WrappedMessage.encode(wmMessage).finish();
|
|
93
|
+
|
|
94
|
+
// Call client API for encoding
|
|
95
|
+
var outBuf = t.newByteBuf(32);
|
|
96
|
+
p30.encodeMediaValue(message)(outBuf);
|
|
97
|
+
// outBuf contains the WM encoded by the client
|
|
98
|
+
|
|
99
|
+
// Removing buf length at the beginning for comparison
|
|
100
|
+
var trimmed = outBuf.buf.slice(1, outBuf.offset);
|
|
101
|
+
// check the client produces same byte buffer
|
|
102
|
+
expect(Buffer.compare(trimmed, expectedWMBuffer)).toBe(0);
|
|
103
|
+
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
);
|
|
107
|
+
|
|
108
|
+
describe("Put/Get protostream object to/from Infinispan", function () {
|
|
109
|
+
it("Puts protostream on Infinispan", async function (done) {
|
|
110
|
+
var root = protobuf.parse(myMsg).root;
|
|
111
|
+
var AwesomeMessage = root.lookupType(".awesomepackage.AwesomeMessage");
|
|
112
|
+
try {
|
|
113
|
+
var protoMetaClient = await ispn.client(t.local, { authentication: t.authOpts.authentication, cacheName: '___protobuf_metadata', dataFormat: { keyType: "text/plain", valueType: "text/plain" } });
|
|
114
|
+
var client = await t.client(t.local, { authentication: t.authOpts.authentication, cacheName: 'protoStreamCache', dataFormat: { keyType: "text/plain", valueType: "application/x-protostream" } });
|
|
115
|
+
var payload = { awesomeField: "AwesomeString" };
|
|
116
|
+
var errMsg = AwesomeMessage.verify(payload);
|
|
117
|
+
expect(errMsg === null).toBeTruthy();
|
|
118
|
+
var message = AwesomeMessage.create(payload);
|
|
119
|
+
|
|
120
|
+
await protoMetaClient.put("awesomepackage/AwesomeMessage.proto", myMsg2);
|
|
121
|
+
|
|
122
|
+
await client.clear();
|
|
123
|
+
expect(await client.size()).toBe(0);
|
|
124
|
+
await client.put("myKey", message);
|
|
125
|
+
expect(await client.size()).toBe(1);
|
|
126
|
+
await client.put("myKey1", 1.2);
|
|
127
|
+
await client.put("myKey2","string");
|
|
128
|
+
await client.put("myKey3",true);
|
|
129
|
+
await client.put("myKey4",new ArrayBuffer(8));
|
|
130
|
+
expect(await client.size()).toBe(5);
|
|
131
|
+
|
|
132
|
+
protoMetaClient.disconnect();
|
|
133
|
+
client.disconnect();
|
|
134
|
+
done();
|
|
135
|
+
} catch (error) {
|
|
136
|
+
protoMetaClient.disconnect();
|
|
137
|
+
client.disconnect();
|
|
138
|
+
done(new Error(error));
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
);
|
|
142
|
+
|
|
143
|
+
it("Gets protostream on Infinispan", async function (done) {
|
|
144
|
+
try {
|
|
145
|
+
var protoMetaClient = await ispn.client(t.local, { authentication: t.authOpts.authentication, cacheName: '___protobuf_metadata', dataFormat: { keyType: "text/plain", valueType: "text/plain" } });
|
|
146
|
+
var client = await t.client(t.local, { authentication: t.authOpts.authentication, cacheName: 'protoStreamCache', dataFormat: { keyType: "text/plain", valueType: "application/x-protostream" } });
|
|
147
|
+
client.registerProtostreamRoot(root);
|
|
148
|
+
var myObj=await client.get("myKey");
|
|
149
|
+
var myObj1=await client.get("myKey1");
|
|
150
|
+
var myObj2=await client.get("myKey2");
|
|
151
|
+
var myObj3=await client.get("myKey3");
|
|
152
|
+
var myObj4=await client.get("myKey4");
|
|
153
|
+
protoMetaClient.disconnect();
|
|
154
|
+
await client.clear();
|
|
155
|
+
client.disconnect();
|
|
156
|
+
done();
|
|
157
|
+
} catch (error) {
|
|
158
|
+
protoMetaClient.disconnect();
|
|
159
|
+
client.disconnect();
|
|
160
|
+
done(new Error(error));
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
);
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
describe('Querying in application/x-protostream format',function () {
|
|
167
|
+
var root = protobuf.parse(myMsg).root;
|
|
168
|
+
var AwesomeMessage = root.lookupType(".awesomepackage.AwesomeMessage");
|
|
169
|
+
var root2 = protobuf.parse(myMsg3).root;
|
|
170
|
+
var AwesomeUser = root2.lookupType(".awesomepackage.AwesomeUser");
|
|
171
|
+
it("Queries the server without projection", async function (done) {
|
|
172
|
+
try{
|
|
173
|
+
var protoMetaClient = await ispn.client(t.local, { authentication: t.authOpts.authentication, cacheName: '___protobuf_metadata', dataFormat: { keyType: "text/plain", valueType: "text/plain" } });
|
|
174
|
+
var client = await t.client(t.local, { authentication: t.authOpts.authentication, cacheName: 'protoStreamCache', dataFormat: { keyType: "application/x-protostream", valueType: "application/x-protostream" } });
|
|
175
|
+
await protoMetaClient.put("awesomepackage/AwesomeMessage.proto", myMsg2);
|
|
176
|
+
await client.clear();
|
|
177
|
+
for(let i=0;i<10;i++){
|
|
178
|
+
var payload = { awesomeField: "AwesomeString"+i };
|
|
179
|
+
var message = AwesomeMessage.create(payload);
|
|
180
|
+
await client.put(i,message)
|
|
181
|
+
}
|
|
182
|
+
var queryResp1 = await client.query({queryString:`from awesomepackage.AwesomeMessage ORDER BY awesome_field`});
|
|
183
|
+
expect(queryResp1.length).toBe(10);
|
|
184
|
+
var queryResp2 = await client.query({queryString:`from awesomepackage.AwesomeMessage a where a.awesome_field='AwesomeString1'`});
|
|
185
|
+
expect(queryResp2.length).toBe(1);
|
|
186
|
+
expect(queryResp2[0].awesomeField).toEqual('AwesomeString1');
|
|
187
|
+
var queryResp3 = await client.query({queryString:`from awesomepackage.AwesomeMessage a where a.awesome_field='AwesomeString100'`});
|
|
188
|
+
expect(queryResp3.length).toEqual(0);
|
|
189
|
+
protoMetaClient.disconnect();
|
|
190
|
+
await client.clear();
|
|
191
|
+
client.disconnect();
|
|
192
|
+
done();
|
|
193
|
+
}catch (error) {
|
|
194
|
+
protoMetaClient.disconnect();
|
|
195
|
+
client.disconnect();
|
|
196
|
+
done(new Error(error));
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
it("Queries the server with projection", async function (done) {
|
|
201
|
+
try{
|
|
202
|
+
var protoMetaClient = await ispn.client(t.local, { authentication: t.authOpts.authentication, cacheName: '___protobuf_metadata', dataFormat: { keyType: "text/plain", valueType: "text/plain" } });
|
|
203
|
+
var client = await t.client(t.local, { authentication: t.authOpts.authentication, cacheName: 'protoStreamCache', dataFormat: { keyType: "application/x-protostream", valueType: "application/x-protostream" } });
|
|
204
|
+
await protoMetaClient.put("awesomepackage/AwesomeUser.proto", myMsg3);
|
|
205
|
+
client.registerProtostreamRoot(root2);
|
|
206
|
+
client.registerProtostreamType(".awesomepackage.AwesomeUser",1000044);
|
|
207
|
+
await client.clear();
|
|
208
|
+
for (let i = 0; i < 10; i++){
|
|
209
|
+
var payload = { name: "AwesomeString"+i , age : i , isVerified: (Math.random()<0.5)};
|
|
210
|
+
var message = AwesomeUser.create(payload);
|
|
211
|
+
await client.put(i,message)
|
|
212
|
+
}
|
|
213
|
+
var query1 = await client.query({ queryString: `select u.name,u.age from awesomepackage.AwesomeUser u where u.age<20 order by u.name asc` });
|
|
214
|
+
expect(query1.length).toBe(10);
|
|
215
|
+
expect(query1[0].length).toBe(2);
|
|
216
|
+
for (let i = 0; i < 10; i++) {
|
|
217
|
+
expect(_.isEqual(query1[i][1], long.fromValue(i))).toBeTruthy();
|
|
218
|
+
}
|
|
219
|
+
var query2 = await client.query({queryString:`select u.name from awesomepackage.AwesomeUser u where u.age=2`});
|
|
220
|
+
expect(query2[0][0]).toBe("AwesomeString2");
|
|
221
|
+
|
|
222
|
+
var query3 = await client.query({queryString:`select u.name from awesomepackage.AwesomeUser u where u.age>20`});
|
|
223
|
+
expect(query3.length).toBe(0);
|
|
224
|
+
|
|
225
|
+
protoMetaClient.disconnect();
|
|
226
|
+
await client.clear();
|
|
227
|
+
client.disconnect();
|
|
228
|
+
done();
|
|
229
|
+
}catch (error) {
|
|
230
|
+
protoMetaClient.disconnect();
|
|
231
|
+
client.disconnect();
|
|
232
|
+
done(new Error(error));
|
|
233
|
+
}
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
}
|
|
237
|
+
);
|
package/spec/utils/testing.js
CHANGED
|
@@ -4,9 +4,6 @@ var _ = require('underscore');
|
|
|
4
4
|
|
|
5
5
|
var log4js = require('log4js');
|
|
6
6
|
|
|
7
|
-
var promiseFinally = require('promise.prototype.finally');
|
|
8
|
-
promiseFinally.shim(); // will be a no-op if not needed
|
|
9
|
-
|
|
10
7
|
var readFile = require('fs').readFile;
|
|
11
8
|
var httpRequest = require('request');
|
|
12
9
|
var util = require('util');
|
|
@@ -96,6 +93,7 @@ exports.client = function(args, opts) {
|
|
|
96
93
|
exports.protocol25 = function() { return protocols.version25(); };
|
|
97
94
|
|
|
98
95
|
exports.protocol29 = function(clientOpts) { return protocols.version29(clientOpts); };
|
|
96
|
+
exports.protocol30 = function(clientOpts) { return protocols.version30(clientOpts); };
|
|
99
97
|
|
|
100
98
|
exports.put = function(k, v, opts) {
|
|
101
99
|
return function(client) { return client.put(k, v, opts); }
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
[id='getting-started']
|
|
2
|
-
:context: getting-started
|
|
3
|
-
= Getting started with {hr_js} clients
|
|
4
|
-
Ensure your system meets requirements before installing the {hr_js} client.
|
|
5
|
-
|
|
6
|
-
include::{topics}/proc_installing_clients.adoc[leveloffset=+1]
|
|
7
|
-
include::{topics}/ref_basic_usage.adoc[leveloffset=+1]
|
|
8
|
-
|
|
9
|
-
// Restore the parent context.
|
|
10
|
-
ifdef::parent-context[:context: {parent-context}]
|
|
11
|
-
ifndef::parent-context[:!context:]
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
:brandname: Infinispan
|
|
2
|
-
:hr_js: Hot Rod JS
|
|
3
|
-
:rhel_long: Red Hat Enterprise Linux (RHEL)
|
|
4
|
-
:rhel_short: RHEL
|
|
5
|
-
:win_long: Microsoft Windows
|
|
6
|
-
:win_short: Windows
|
|
7
|
-
|
|
8
|
-
:doc_home: https://infinispan.org/documentation/
|
|
9
|
-
:download_url: https://infinispan.org/hotrod-clients
|
|
10
|
-
:js_api_docs: https://docs.jboss.org/infinispan/hotrod-clients/javascript/1.0/apidocs/
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
:brandname: Data Grid
|
|
2
|
-
:hr_js: Hot Rod JS
|
|
3
|
-
:rhel_long: Red Hat Enterprise Linux (RHEL)
|
|
4
|
-
:rhel_short: RHEL
|
|
5
|
-
:win_long: Microsoft Windows
|
|
6
|
-
:win_short: Windows
|
|
7
|
-
|
|
8
|
-
:doc_home: https://access.redhat.com/documentation/en-us/red_hat_data_grid/
|
|
9
|
-
:download_url: https://access.redhat.com/jbossnetwork/restricted/listSoftware.html?product=data.grid&downloadType=distributions
|
|
10
|
-
:js_api_docs: https://access.redhat.com/webassets/avalon/d/red-hat-data-grid/8.2/node/
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
[id='executing-scripts_{context}']
|
|
2
|
-
= Executing scripts on {brandname} Server
|
|
3
|
-
|
|
4
|
-
You can add custom scripts, such as the following to {brandname} Server:
|
|
5
|
-
|
|
6
|
-
[source,javascript,options="nowrap",subs=attributes+]
|
|
7
|
-
----
|
|
8
|
-
include::code_examples/sample-script.js[]
|
|
9
|
-
----
|
|
10
|
-
|
|
11
|
-
The {hr_js} client can load and execute the sample script as follows:
|
|
12
|
-
|
|
13
|
-
[source,javascript,options="nowrap",subs=attributes+]
|
|
14
|
-
----
|
|
15
|
-
include::code_examples/sample-script-execute.js[]
|
|
16
|
-
----
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
[id='registering-event-listeners_{context}']
|
|
2
|
-
= Registering event listeners
|
|
3
|
-
|
|
4
|
-
Clients can register event listeners that get invoked when data changes happen.
|
|
5
|
-
Create, modified, remove and expired events are supported.
|
|
6
|
-
Create and modified events emit key and version of value after event.
|
|
7
|
-
Remove and expired events only emit key information.
|
|
8
|
-
|
|
9
|
-
[source,javascript,options="nowrap",subs=attributes+]
|
|
10
|
-
----
|
|
11
|
-
include::code_examples/register-event-listener.js[]
|
|
12
|
-
----
|
|
13
|
-
|
|
14
|
-
Starting with client version `0.7` and Infinispan `9.4.x` server,
|
|
15
|
-
it's possible to tailor events to add or remove information from each event.
|
|
16
|
-
|
|
17
|
-
For example, a user might want to find out the value associated with the key after an event.
|
|
18
|
-
If the value was sent back along with the key within the event, unnecessary round trips to fetch the value would be avoided.
|
|
19
|
-
This can be achieved configuring the listener with a remote event converter.
|
|
20
|
-
|
|
21
|
-
Infinispan servers come with a converter called `key-value-with-previous-converter-factory` which can be used for this purpose:
|
|
22
|
-
|
|
23
|
-
[source,javascript,options="nowrap",subs=attributes+]
|
|
24
|
-
----
|
|
25
|
-
include::code_examples/key-value-converter.js[]
|
|
26
|
-
----
|
|
27
|
-
|
|
28
|
-
You can also create and deploy your own converters into Infinispan server instances.
|
|
29
|
-
See the
|
|
30
|
-
[event filter and conversion](https://infinispan.org/docs/stable/titles/developing/developing.html#event_filtering_and_conversion)
|
|
31
|
-
section in the Developers Guide for more information.
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
[id='using-async-await_{context}']
|
|
2
|
-
= Using Async and Await constructs
|
|
3
|
-
|
|
4
|
-
Examples above can be greatly simplified taking advantage of `async` / `await` constructs,
|
|
5
|
-
which are available in Node.js since version `7.10.0`.
|
|
6
|
-
|
|
7
|
-
This section shows how some of the examples above can be written using `async` / `await`:
|
|
8
|
-
|
|
9
|
-
[discrete]
|
|
10
|
-
== Working with single entries and statistics
|
|
11
|
-
|
|
12
|
-
[source,javascript,options="nowrap",subs=attributes+]
|
|
13
|
-
----
|
|
14
|
-
include::code_examples/await-single-entries.js[]
|
|
15
|
-
----
|
|
16
|
-
|
|
17
|
-
[discrete]
|
|
18
|
-
== Working with multiple entries
|
|
19
|
-
|
|
20
|
-
[source,javascript,options="nowrap",subs=attributes+]
|
|
21
|
-
----
|
|
22
|
-
include::code_examples/await-multiple-entries.js[]
|
|
23
|
-
----
|