infinispan 0.9.0 → 0.11.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/.eslintrc +25 -0
- package/Jenkinsfile-release +5 -3
- 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 +2 -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/queries.js +92 -0
- 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 +128 -0
- package/lib/codec.js +153 -2
- package/lib/infinispan.js +87 -57
- 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 +10 -12
- package/run-servers.sh +1 -1
- package/smoke-tests.sh +1 -0
- 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/types/README.md +91 -0
- package/types/index.d.ts +868 -0
- package/.jshintrc +0 -14
- 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
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
syntax = "proto2";
|
|
2
|
+
|
|
3
|
+
package org.infinispan.protostream;
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Protobuf messages do not indicate their message type or structure. Readers of protobuf data streams are expected to
|
|
7
|
+
* know in advance what message type to expect next in the stream. Also, the wire format is not self-delimiting so the
|
|
8
|
+
* length of the next message must be computed based on the known schema so that not too much nor too little is read.
|
|
9
|
+
* This is particularly important if a sequence of multiple messages are contained in a stream. A detailed explanation
|
|
10
|
+
* is offered here: https://developers.google.com/protocol-buffers/docs/techniques#streaming
|
|
11
|
+
* <p>
|
|
12
|
+
* WrappedMessage solves this problem of self-describing messages by allowing the stream reader to detect
|
|
13
|
+
* the type of the message. Still, only the type name (or type id) is provided but the actual schema is not provided as
|
|
14
|
+
* it would not be efficient to carry so much information over the wire with each message. The application is expected
|
|
15
|
+
* to have knowledge of the schema and use it once it learns the type name/id.
|
|
16
|
+
* <p>
|
|
17
|
+
* This is similar to 'google.protobuf.Any' but is also able to handle scalars not just messages.
|
|
18
|
+
* <p>
|
|
19
|
+
* Fields should ideally arrive in the data stream in the order defined here for efficiency reasons, but implementations
|
|
20
|
+
* should be able to deal with any field order.
|
|
21
|
+
*
|
|
22
|
+
* @TypeId(0)
|
|
23
|
+
*/
|
|
24
|
+
message WrappedMessage {
|
|
25
|
+
|
|
26
|
+
// Exactly one of the following fields is used if the wrapped value is a primitive (scalar) type.
|
|
27
|
+
oneof scalarOrMessage {
|
|
28
|
+
double wrappedDouble = 1;
|
|
29
|
+
float wrappedFloat = 2;
|
|
30
|
+
int64 wrappedInt64 = 3;
|
|
31
|
+
uint64 wrappedUInt64 = 4;
|
|
32
|
+
int32 wrappedInt32 = 5;
|
|
33
|
+
fixed64 wrappedFixed64 = 6;
|
|
34
|
+
fixed32 wrappedFixed32 = 7;
|
|
35
|
+
bool wrappedBool = 8;
|
|
36
|
+
string wrappedString = 9;
|
|
37
|
+
bytes wrappedBytes = 10;
|
|
38
|
+
uint32 wrappedUInt32 = 11;
|
|
39
|
+
sfixed32 wrappedSFixed32 = 12;
|
|
40
|
+
sfixed64 wrappedSFixed64 = 13;
|
|
41
|
+
sint32 wrappedSInt32 = 14;
|
|
42
|
+
sint64 wrappedSInt64 = 15;
|
|
43
|
+
|
|
44
|
+
/** There is no native char type in protobuf so it is mapped to int32. */
|
|
45
|
+
int32 wrappedChar = 20;
|
|
46
|
+
|
|
47
|
+
/** There is no native short type in protobuf so it is mapped to int32. */
|
|
48
|
+
int32 wrappedShort = 21;
|
|
49
|
+
|
|
50
|
+
/** There is no native byte type in protobuf so it is mapped to int32. */
|
|
51
|
+
int32 wrappedByte = 22;
|
|
52
|
+
|
|
53
|
+
/** There is no native Date type in protobuf so it is mapped to int64 (milliseconds). */
|
|
54
|
+
int64 wrappedDateMillis = 23;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* There is no native Instant type in protobuf so it is mapped to an int64 (the seconds) + an int32 (the nanoseconds).
|
|
58
|
+
* The field wrappedInstantNanos must be also present if this field is present.
|
|
59
|
+
* A close equivalent to this, with binary compatible representation, is google.protobuf.Timestamp defined in timestamp.proto.
|
|
60
|
+
*/
|
|
61
|
+
int64 wrappedInstantSeconds = 24;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* This is used if the wrapped value is an enum. The actual type is indicated by oneof typeNameOrId, which
|
|
65
|
+
* is required if this field is present.
|
|
66
|
+
*/
|
|
67
|
+
int32 wrappedEnum = 18;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Stores the message's protobuf encoded bytes when the wrapped value is a message type.
|
|
71
|
+
* This is similar to google.protobuf.Any.value field. The actual type is indicated by oneof typeNameOrId, which
|
|
72
|
+
* is required if this field is present.
|
|
73
|
+
*/
|
|
74
|
+
bytes wrappedMessage = 17;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* A flag that indicates that the contents of the wrapper is empty/null.
|
|
78
|
+
*/
|
|
79
|
+
bool wrappedEmpty = 26;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* The nanoseconds of the Instant. Always present if wrappedInstantSeconds is present.
|
|
84
|
+
* This field is declared outside of scalarOrMessage oneof because it's not legal to have two of the oneof fields
|
|
85
|
+
* present simultaneously in the data stream.
|
|
86
|
+
*/
|
|
87
|
+
optional int32 wrappedInstantNanos = 25;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Stores the fully qualified type name or the optional numeric type id of the payload. This is not used for primitive types
|
|
91
|
+
* (scalars), only for message and enum types.
|
|
92
|
+
*/
|
|
93
|
+
oneof typeNameOrId {
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Stores the fully qualified type name if the wrapped value is a message or an enum type.
|
|
97
|
+
* This is similar to google.protobuf.Any.type_url field.
|
|
98
|
+
*/
|
|
99
|
+
string wrappedTypeName = 16;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* This is used as an alternative to wrappedTypeName if a unique id was assigned to the type with the TypeId
|
|
103
|
+
* annotation. Values in the range 0..65535 are reserved for internal use by Protostream and other projects
|
|
104
|
+
* from the Infinispan organisation.
|
|
105
|
+
*/
|
|
106
|
+
uint32 wrappedTypeId = 19;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Number of repeated elements. Optional; if present it indicates a container (array or Collection). The value must
|
|
111
|
+
* be positive, or 0 if the array/collection is empty. If this is present, then containerTypeNameOrId and
|
|
112
|
+
* containerMessage must also be present.
|
|
113
|
+
*/
|
|
114
|
+
optional uint32 wrappedContainerSize = 27;
|
|
115
|
+
|
|
116
|
+
oneof wrappedContainerTypeNameOrId {
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Stores the fully qualified type name if the container.
|
|
120
|
+
*/
|
|
121
|
+
string wrappedContainerTypeName = 28;
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* This is used as an alternative to wrappedContainerTypeName if a unique id was assigned to the type with the
|
|
125
|
+
*/
|
|
126
|
+
uint32 wrappedContainerTypeId = 29;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* The fields of the container itself. Must always be present when wrappedContainerSize is present. If the container
|
|
131
|
+
* type itself does not have any fields then this will be a zero length bytes field.
|
|
132
|
+
*/
|
|
133
|
+
optional bytes wrappedContainerMessage = 30;
|
|
134
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**********************************************************************************************************************
|
|
2
|
+
* REMOTE QUERY RELATED PROTOBUF DEFINITIONS *
|
|
3
|
+
* *
|
|
4
|
+
* Allocated TypeId range is: [4400 .. 4599] (see org.infinispan.commons.marshall.ProtoStreamTypeIds) *
|
|
5
|
+
* Actually used range is: [4400 .. 4403] *
|
|
6
|
+
*********************************************************************************************************************/
|
|
7
|
+
syntax = "proto2";
|
|
8
|
+
import "Protos/message-wrapping.proto";
|
|
9
|
+
|
|
10
|
+
package org.infinispan.query.remote.client;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @TypeId(4400)
|
|
14
|
+
*/
|
|
15
|
+
message QueryRequest {
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The query string, in Infinispan's query language aka Ickle (a JP-QL micro-subset with full-text enhancements).
|
|
19
|
+
*/
|
|
20
|
+
required string queryString = 1;
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The number of matching results to skip before the first returned result.
|
|
25
|
+
*/
|
|
26
|
+
optional int64 startOffset = 3;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Maximum number of matching results to return.
|
|
30
|
+
*/
|
|
31
|
+
optional int32 maxResults = 4;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Multiple, optional, named parameters. Each name must occur only once.
|
|
35
|
+
*/
|
|
36
|
+
repeated NamedParameter namedParameters = 5;
|
|
37
|
+
/**
|
|
38
|
+
* Whether the query is limited to the data from node that receives the request
|
|
39
|
+
*/
|
|
40
|
+
optional bool local = 6;
|
|
41
|
+
|
|
42
|
+
message NamedParameter {
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Parameter unique name.
|
|
46
|
+
*/
|
|
47
|
+
required string name = 1;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Parameter value.
|
|
51
|
+
*/
|
|
52
|
+
required org.infinispan.protostream.WrappedMessage value = 2;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* @TypeId(4401)
|
|
58
|
+
*/
|
|
59
|
+
message QueryResponse {
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* The number of returned results.
|
|
63
|
+
*/
|
|
64
|
+
required int32 numResults = 1;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Indicates presence and size of projections.
|
|
68
|
+
*
|
|
69
|
+
* 0 - no projection
|
|
70
|
+
* 1 .. N - projection with N components
|
|
71
|
+
* < 0 - illegal value
|
|
72
|
+
*/
|
|
73
|
+
required int32 projectionSize = 2;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* The list of matching results. The size should be either numResults, if no projections are used, or numResults *
|
|
77
|
+
* projectionSize otherwise. If projections are used, then each group of projectionSize consecutive elements
|
|
78
|
+
* represent together a row from the result. We use this simple schema in order to avoid bi-dimensional arrays when
|
|
79
|
+
* projections are present.
|
|
80
|
+
*/
|
|
81
|
+
repeated org.infinispan.protostream.WrappedMessage results = 3;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Total number of results that match the query. This is usually larger than numResults due to
|
|
85
|
+
* QueryRequest.startOffset and QueryRequest.maxResults.
|
|
86
|
+
*/
|
|
87
|
+
required int64 totalResults = 4;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* @TypeId(4402)
|
|
92
|
+
*/
|
|
93
|
+
message FilterResult {
|
|
94
|
+
|
|
95
|
+
optional bytes instance = 1;
|
|
96
|
+
|
|
97
|
+
repeated org.infinispan.protostream.WrappedMessage projection = 2;
|
|
98
|
+
|
|
99
|
+
repeated org.infinispan.protostream.WrappedMessage sortProjection = 3;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* @TypeId(4403)
|
|
104
|
+
*/
|
|
105
|
+
message ContinuousQueryResult {
|
|
106
|
+
|
|
107
|
+
enum ResultType {
|
|
108
|
+
LEAVING = 0;
|
|
109
|
+
JOINING = 1;
|
|
110
|
+
UPDATED = 2;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
required ResultType resultType = 1;
|
|
114
|
+
|
|
115
|
+
required bytes key = 2;
|
|
116
|
+
|
|
117
|
+
/* Only present if resultType is JOINING or UPDATED and 'projection' field is missing */
|
|
118
|
+
optional bytes value = 3;
|
|
119
|
+
|
|
120
|
+
/* Only present if resultType is JOINING or UPDATED and 'value' field is missing */
|
|
121
|
+
repeated org.infinispan.protostream.WrappedMessage projection = 4;
|
|
122
|
+
}
|
package/lib/sasl/bitops.js
CHANGED
|
@@ -1,21 +1,19 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var xor = require('bitwise-xor');
|
|
4
|
-
|
|
1
|
+
var crypto = require('crypto');
|
|
2
|
+
var xor = require('buffer-xor');
|
|
5
3
|
|
|
6
4
|
exports.XOR = xor;
|
|
7
5
|
|
|
8
6
|
exports.H = function (algorithm, str) {
|
|
9
|
-
return createHash(algorithm).update(str).digest();
|
|
7
|
+
return crypto.createHash(algorithm).update(str).digest();
|
|
10
8
|
};
|
|
11
9
|
|
|
12
10
|
exports.HMAC = function (algorithm, key, str) {
|
|
13
|
-
return createHmac(algorithm, key).update(str).digest();
|
|
11
|
+
return crypto.createHmac(algorithm, key).update(str).digest();
|
|
14
12
|
};
|
|
15
13
|
|
|
16
14
|
exports.Hi = function (algorithm, str, salt, iterations) {
|
|
17
15
|
var INT1 = Buffer.from([0, 0, 0, 1], 'binary');
|
|
18
|
-
var ui1 = createHmac(algorithm, str).update(salt).update(INT1).digest();
|
|
16
|
+
var ui1 = crypto.createHmac(algorithm, str).update(salt).update(INT1).digest();
|
|
19
17
|
var ui = ui1;
|
|
20
18
|
for (var i = 1; i < iterations; i++) {
|
|
21
19
|
ui1 = exports.HMAC(algorithm, str, ui1);
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
(function(root, factory) {
|
|
2
|
+
if (typeof exports === 'object') {
|
|
3
|
+
// CommonJS
|
|
4
|
+
factory(exports, module);
|
|
5
|
+
} else if (typeof define === 'function' && define.amd) {
|
|
6
|
+
// AMD
|
|
7
|
+
define(['exports', 'module'], factory);
|
|
8
|
+
}
|
|
9
|
+
}(this, function(exports, module) {
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* `Factory` constructor.
|
|
13
|
+
*
|
|
14
|
+
* @api public
|
|
15
|
+
*/
|
|
16
|
+
function Factory() {
|
|
17
|
+
this._mechs = [];
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Utilize the given `mech` with optional `name`, overridding the mechanism's
|
|
22
|
+
* default name.
|
|
23
|
+
*
|
|
24
|
+
* Examples:
|
|
25
|
+
*
|
|
26
|
+
* factory.use(FooMechanism);
|
|
27
|
+
*
|
|
28
|
+
* factory.use('XFOO', FooMechanism);
|
|
29
|
+
*
|
|
30
|
+
* @param {String|Mechanism} name
|
|
31
|
+
* @param {Mechanism} mech
|
|
32
|
+
* @return {Factory} for chaining
|
|
33
|
+
* @api public
|
|
34
|
+
*/
|
|
35
|
+
Factory.prototype.use = function(name, mech) {
|
|
36
|
+
if (!mech) {
|
|
37
|
+
mech = name;
|
|
38
|
+
name = mech.prototype.name;
|
|
39
|
+
}
|
|
40
|
+
this._mechs.push({ name: name, mech: mech });
|
|
41
|
+
return this;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Create a new mechanism from supported list of `mechs`.
|
|
46
|
+
*
|
|
47
|
+
* If no mechanisms are supported, returns `null`.
|
|
48
|
+
*
|
|
49
|
+
* Examples:
|
|
50
|
+
*
|
|
51
|
+
* var mech = factory.create(['FOO', 'BAR']);
|
|
52
|
+
*
|
|
53
|
+
* @param {Array} mechs
|
|
54
|
+
* @return {Mechanism}
|
|
55
|
+
* @api public
|
|
56
|
+
*/
|
|
57
|
+
Factory.prototype.create = function(mechs) {
|
|
58
|
+
for (var i = 0, len = this._mechs.length; i < len; i++) {
|
|
59
|
+
for (var j = 0, jlen = mechs.length; j < jlen; j++) {
|
|
60
|
+
var entry = this._mechs[i];
|
|
61
|
+
if (entry.name == mechs[j]) {
|
|
62
|
+
return new entry.mech();
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return null;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
exports = module.exports = Factory;
|
|
70
|
+
|
|
71
|
+
}));
|
package/lib/utils.js
CHANGED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const v8 = require('v8');
|
|
3
|
+
|
|
4
|
+
exports.createHeapSnapshot = function() {
|
|
5
|
+
const snapshotStream = v8.getHeapSnapshot();
|
|
6
|
+
const fileName = `${Date.now()}.heapsnapshot`;
|
|
7
|
+
const fileStream = fs.createWriteStream('/tmp/' + fileName);
|
|
8
|
+
snapshotStream.pipe(fileStream);
|
|
9
|
+
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
var _ = require('underscore');
|
|
2
2
|
var infinispan = require('../lib/infinispan');
|
|
3
|
-
|
|
4
|
-
var heapdump = require('heapdump');
|
|
3
|
+
var helper = require('./helper');
|
|
5
4
|
|
|
6
5
|
var connected = infinispan.client({port: 11222, host: '127.0.0.1'},{cacheName: 'namedCache'});
|
|
7
6
|
console.log("Connected to JDG server");
|
|
@@ -12,7 +11,6 @@ connected.then(function (client) {
|
|
|
12
11
|
|
|
13
12
|
return put.then(function() {
|
|
14
13
|
var heapUseAfterPut = process.memoryUsage().heapUsed;
|
|
15
|
-
//heapdump.writeSnapshot('/tmp/' + Date.now() + '.heapsnapshot');
|
|
16
14
|
|
|
17
15
|
var temp = [];
|
|
18
16
|
var numOps = 10000; // 500000
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
var _ = require('underscore');
|
|
2
2
|
var infinispan = require('../lib/infinispan');
|
|
3
|
+
var helper = require('./helper');
|
|
3
4
|
|
|
4
|
-
|
|
5
|
+
const fs = require('fs');
|
|
6
|
+
const v8 = require('v8');
|
|
5
7
|
|
|
6
8
|
var connected = infinispan.client({port: 11222, host: '127.0.0.1'},{cacheName: 'namedCache'});
|
|
7
9
|
console.log("Connected to JDG server");
|
|
@@ -12,7 +14,7 @@ connected.then(function (client) {
|
|
|
12
14
|
var afterPut = put.then(function() {
|
|
13
15
|
//console.log("After put, heapUsed: "+process.memoryUsage().heapUsed);
|
|
14
16
|
|
|
15
|
-
|
|
17
|
+
helper.createHeapSnapshot();
|
|
16
18
|
});
|
|
17
19
|
|
|
18
20
|
var get1 = afterPut.then(function test_get1() {
|
|
@@ -27,7 +29,7 @@ connected.then(function (client) {
|
|
|
27
29
|
global.gc();
|
|
28
30
|
//console.log("After get1, heapUsed: "+process.memoryUsage().heapUsed);
|
|
29
31
|
|
|
30
|
-
|
|
32
|
+
helper.createHeapSnapshot();
|
|
31
33
|
});
|
|
32
34
|
|
|
33
35
|
var get2 = dumpAfterGet1.then(function test_get2() {
|
|
@@ -42,7 +44,7 @@ connected.then(function (client) {
|
|
|
42
44
|
global.gc();
|
|
43
45
|
//console.log("After get2, heapUsed: "+process.memoryUsage().heapUsed);
|
|
44
46
|
|
|
45
|
-
|
|
47
|
+
helper.createHeapSnapshot();
|
|
46
48
|
});
|
|
47
49
|
|
|
48
50
|
return dumpAfterGet2.then(function test_disconnect() {
|
package/package.json
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "infinispan",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "Infinispan Javascript client",
|
|
5
5
|
"main": "index",
|
|
6
|
+
"typings": "./types",
|
|
6
7
|
"directories": {
|
|
7
8
|
"test": "test"
|
|
8
9
|
},
|
|
9
10
|
"scripts": {
|
|
11
|
+
"lint": "eslint --ignore-path .gitignore .",
|
|
10
12
|
"test": "./node_modules/.bin/jasmine-node spec"
|
|
11
13
|
},
|
|
12
14
|
"author": "Galder Zamarreño",
|
|
@@ -25,20 +27,16 @@
|
|
|
25
27
|
"url": "https://github.com/infinispan/js-client"
|
|
26
28
|
},
|
|
27
29
|
"dependencies": {
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"promise.prototype.finally": "^3.1.0",
|
|
33
|
-
"randombytes": "^2.0.1",
|
|
34
|
-
"saslmechanisms": "^0.1.1",
|
|
35
|
-
"underscore": "^1.9.1"
|
|
30
|
+
"buffer-xor": "^2.0.2",
|
|
31
|
+
"log4js": "^6.4.6",
|
|
32
|
+
"protobufjs": "^7.0.0",
|
|
33
|
+
"underscore": "^1.13.3"
|
|
36
34
|
},
|
|
37
35
|
"devDependencies": {
|
|
36
|
+
"eslint": "^8.26.0",
|
|
38
37
|
"growl": "^1.10.5",
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"jsdoc": "^3.6.6",
|
|
38
|
+
"jasmine-node": "^3.0.0",
|
|
39
|
+
"jsdoc": "^3.6.10",
|
|
42
40
|
"request": "^2.88.0"
|
|
43
41
|
}
|
|
44
42
|
}
|
package/run-servers.sh
CHANGED
|
@@ -9,7 +9,7 @@ else
|
|
|
9
9
|
fi
|
|
10
10
|
|
|
11
11
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
12
|
-
SERVER_VERSION="${SERVER_VERSION:-"
|
|
12
|
+
SERVER_VERSION="${SERVER_VERSION:-"13.0.0.Final"}"
|
|
13
13
|
SERVER_HOME=${SCRIPT_DIR}/server/original-server
|
|
14
14
|
SERVER_ZIP=${SCRIPT_DIR}/server/${SERVER_VERSION}.zip
|
|
15
15
|
CLUSTER_SIZE_MAIN="$SERVER_HOME/bin/cli.sh -c http://admin:pass@localhost:11322 -f batch "
|
package/smoke-tests.sh
CHANGED
package/spec/codec_spec.js
CHANGED
|
@@ -120,7 +120,7 @@ function strSize(str) {
|
|
|
120
120
|
|
|
121
121
|
describe('Variable number encode/decode', function() {
|
|
122
122
|
it('can resize buffer when encoding a VInt', function() {
|
|
123
|
-
assert(Math.pow(2,
|
|
123
|
+
assert(Math.pow(2, 32) - 1, 5, singleVIntEncode(Math.pow(2, 32) - 1), singleVIntDecode, 1);
|
|
124
124
|
});
|
|
125
125
|
it('can resize buffer when encoding a VLong', function() {
|
|
126
126
|
assert(Math.pow(2, 53) - 1, 8, singleVLongEncode(Math.pow(2, 53) - 1), singleVLongDecode, 1);
|
|
@@ -134,12 +134,12 @@ describe('Variable number encode/decode', function() {
|
|
|
134
134
|
it('can encode 2^21', function() { encodeDecodeVNum(Math.pow(2, 21)); });
|
|
135
135
|
it('can encode 2^28 - 1', function() { encodeDecodeVNum(Math.pow(2, 28) - 1); });
|
|
136
136
|
it('can encode 2^28', function() { encodeDecodeVNum(Math.pow(2, 28)); });
|
|
137
|
-
it('can encode 2^
|
|
138
|
-
it('fails to encode 2^
|
|
139
|
-
var encode = f.actions([codec.encodeVInt(Math.pow(2,
|
|
140
|
-
expect(function() { encode(t.newByteBuf()) }).toThrow('must be less than 2^
|
|
137
|
+
it('can encode 2^32 - 1', function() { encodeDecodeVNum(Math.pow(2, 32) - 1); });
|
|
138
|
+
it('fails to encode 2^32 as a VInt because it is out of bounds', function() {
|
|
139
|
+
var encode = f.actions([codec.encodeVInt(Math.pow(2, 32))], codec.bytesEncoded);
|
|
140
|
+
expect(function() { encode(t.newByteBuf()) }).toThrow('must be less than 2^32');
|
|
141
141
|
});
|
|
142
|
-
it('can encode 2^
|
|
142
|
+
it('can encode 2^32', function() { encodeDecodeVLong(Math.pow(2, 32)); });
|
|
143
143
|
it('can encode 2^35 - 1', function() { encodeDecodeVLong(Math.pow(2, 35) - 1); });
|
|
144
144
|
it('can encode 2^35', function() { encodeDecodeVLong(Math.pow(2, 35)); });
|
|
145
145
|
it('can encode 2^42 - 1', function() { encodeDecodeVLong(Math.pow(2, 42) - 1); });
|
|
@@ -155,7 +155,7 @@ describe('Variable number encode/decode', function() {
|
|
|
155
155
|
it('fails to encode a number when it is not a number', function() {
|
|
156
156
|
var encode = f.actions([codec.encodeVInt('blah')], codec.bytesEncoded);
|
|
157
157
|
expect(function() { encode(t.newByteBuf()) })
|
|
158
|
-
.toThrow('must be a number, must be >= 0, must be less than 2^
|
|
158
|
+
.toThrow('must be a number, must be >= 0, must be less than 2^32');
|
|
159
159
|
});
|
|
160
160
|
it('fails to encode a number when it is negative', function() {
|
|
161
161
|
var encode = f.actions([codec.encodeVInt(-1)], codec.bytesEncoded);
|
|
@@ -1,9 +1,9 @@
|
|
|
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="clustered" default-cache="default">
|
|
9
9
|
<!-- <security>-->
|
|
@@ -11,13 +11,14 @@
|
|
|
11
11
|
<!-- </security>-->
|
|
12
12
|
<transport cluster="${infinispan.cluster.name}" stack="${infinispan.cluster.stack:tcp}" node-name="${infinispan.node.name:}"/>
|
|
13
13
|
<!--<global-state/>-->
|
|
14
|
+
<metrics accurate-size="true"/>
|
|
14
15
|
<distributed-cache name="default" segments="20" remote-timeout="30000">
|
|
15
16
|
<locking acquire-timeout="30000" concurrency-level="1000" />
|
|
16
17
|
<encoding media-type="text/plain"/>
|
|
17
18
|
</distributed-cache>
|
|
18
19
|
</cache-container>
|
|
19
20
|
|
|
20
|
-
<server xmlns="urn:infinispan:server:
|
|
21
|
+
<server xmlns="urn:infinispan:server:13.0">
|
|
21
22
|
<interfaces>
|
|
22
23
|
<interface name="public">
|
|
23
24
|
<inet-address value="${infinispan.bind.address:127.0.0.1}"/>
|
|
@@ -47,14 +48,16 @@
|
|
|
47
48
|
</security-realms>
|
|
48
49
|
</security>
|
|
49
50
|
|
|
50
|
-
|
|
51
|
-
<
|
|
52
|
-
<
|
|
53
|
-
<
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
51
|
+
<endpoints>
|
|
52
|
+
<endpoint socket-binding="default" security-realm="default">
|
|
53
|
+
<hotrod-connector name="hotrod">
|
|
54
|
+
<authentication>
|
|
55
|
+
<sasl mechanisms="PLAIN"
|
|
56
|
+
server-name="infinispan"/>
|
|
57
|
+
</authentication>
|
|
58
|
+
</hotrod-connector>
|
|
59
|
+
<rest-connector name="rest"/>
|
|
60
|
+
</endpoint>
|
|
58
61
|
</endpoints>
|
|
59
62
|
</server>
|
|
60
|
-
</infinispan>
|
|
63
|
+
</infinispan>
|
|
@@ -1,12 +1,13 @@
|
|
|
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="local" default-cache="default" statistics="true">
|
|
9
9
|
<global-state/>
|
|
10
|
+
<metrics accurate-size="true"/>
|
|
10
11
|
<security>
|
|
11
12
|
<authorization/>
|
|
12
13
|
</security>
|
|
@@ -23,7 +24,7 @@
|
|
|
23
24
|
</local-cache>
|
|
24
25
|
</cache-container>
|
|
25
26
|
|
|
26
|
-
<server xmlns="urn:infinispan:server:
|
|
27
|
+
<server xmlns="urn:infinispan:server:13.0">
|
|
27
28
|
<interfaces>
|
|
28
29
|
<interface name="public">
|
|
29
30
|
<inet-address value="${infinispan.bind.address:127.0.0.1}"/>
|
|
@@ -89,24 +90,26 @@
|
|
|
89
90
|
</security-realms>
|
|
90
91
|
</security>
|
|
91
92
|
|
|
92
|
-
<endpoints
|
|
93
|
-
<
|
|
94
|
-
<
|
|
95
|
-
<
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
93
|
+
<endpoints>
|
|
94
|
+
<endpoint socket-binding="default" security-realm="default">
|
|
95
|
+
<hotrod-connector>
|
|
96
|
+
<authentication>
|
|
97
|
+
<sasl mechanisms="PLAIN"
|
|
98
|
+
server-name="infinispan"/>
|
|
99
|
+
</authentication>
|
|
100
|
+
</hotrod-connector>
|
|
101
|
+
<rest-connector/>
|
|
102
|
+
</endpoint>
|
|
103
|
+
<endpoint socket-binding="hotrod-trust" security-realm="client-cert">
|
|
104
|
+
<hotrod-connector>
|
|
105
|
+
<authentication>
|
|
106
|
+
<sasl mechanisms="PLAIN"
|
|
107
|
+
server-name="infinispan"/>
|
|
108
|
+
</authentication>
|
|
109
|
+
</hotrod-connector>
|
|
110
|
+
<rest-connector/>
|
|
111
|
+
</endpoint>
|
|
100
112
|
</endpoints>
|
|
101
113
|
|
|
102
|
-
<endpoints socket-binding="hotrod-trust" security-realm="client-cert">
|
|
103
|
-
<hotrod-connector>
|
|
104
|
-
<authentication>
|
|
105
|
-
<sasl mechanisms="PLAIN"
|
|
106
|
-
server-name="infinispan"/>
|
|
107
|
-
</authentication>
|
|
108
|
-
</hotrod-connector>
|
|
109
|
-
<rest-connector/>
|
|
110
|
-
</endpoints>
|
|
111
114
|
</server>
|
|
112
115
|
</infinispan>
|