redis 3.1.0 → 3.1.1

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.
Files changed (48) hide show
  1. package/README.md +1 -1
  2. package/heroku/index.js +14 -0
  3. package/heroku/node_modules/.package-lock.json +57 -0
  4. package/heroku/node_modules/denque/CHANGELOG.md +4 -0
  5. package/heroku/node_modules/denque/LICENSE +13 -0
  6. package/heroku/node_modules/denque/README.md +362 -0
  7. package/heroku/node_modules/denque/index.d.ts +31 -0
  8. package/heroku/node_modules/denque/index.js +443 -0
  9. package/heroku/node_modules/denque/package.json +55 -0
  10. package/heroku/node_modules/redis/.deepsource.toml +9 -0
  11. package/heroku/node_modules/redis/CHANGELOG.md +880 -0
  12. package/heroku/node_modules/redis/LICENSE +24 -0
  13. package/heroku/node_modules/redis/README.md +1009 -0
  14. package/{a.js → heroku/node_modules/redis/a.js} +0 -0
  15. package/heroku/node_modules/redis/index.js +1039 -0
  16. package/heroku/node_modules/redis/lib/command.js +16 -0
  17. package/heroku/node_modules/redis/lib/commands.js +105 -0
  18. package/heroku/node_modules/redis/lib/createClient.js +88 -0
  19. package/heroku/node_modules/redis/lib/customErrors.js +58 -0
  20. package/heroku/node_modules/redis/lib/debug.js +13 -0
  21. package/heroku/node_modules/redis/lib/extendedApi.js +113 -0
  22. package/heroku/node_modules/redis/lib/individualCommands.js +629 -0
  23. package/heroku/node_modules/redis/lib/multi.js +187 -0
  24. package/heroku/node_modules/redis/lib/utils.js +134 -0
  25. package/{npm → heroku/node_modules/redis/npm} +0 -0
  26. package/heroku/node_modules/redis/package.json +77 -0
  27. package/heroku/node_modules/redis-commands/LICENSE +22 -0
  28. package/heroku/node_modules/redis-commands/README.md +51 -0
  29. package/heroku/node_modules/redis-commands/changelog.md +83 -0
  30. package/heroku/node_modules/redis-commands/commands.json +2334 -0
  31. package/heroku/node_modules/redis-commands/index.js +168 -0
  32. package/heroku/node_modules/redis-commands/package.json +41 -0
  33. package/heroku/node_modules/redis-commands/tools/build.js +62 -0
  34. package/heroku/node_modules/redis-errors/LICENSE +22 -0
  35. package/heroku/node_modules/redis-errors/README.md +116 -0
  36. package/heroku/node_modules/redis-errors/index.js +7 -0
  37. package/heroku/node_modules/redis-errors/lib/modern.js +59 -0
  38. package/heroku/node_modules/redis-errors/lib/old.js +119 -0
  39. package/heroku/node_modules/redis-errors/package.json +41 -0
  40. package/heroku/node_modules/redis-parser/LICENSE +22 -0
  41. package/heroku/node_modules/redis-parser/README.md +166 -0
  42. package/heroku/node_modules/redis-parser/changelog.md +156 -0
  43. package/heroku/node_modules/redis-parser/index.js +3 -0
  44. package/heroku/node_modules/redis-parser/lib/parser.js +552 -0
  45. package/heroku/node_modules/redis-parser/package.json +53 -0
  46. package/heroku/package.json +9 -0
  47. package/lib/utils.js +1 -1
  48. package/package.json +1 -1
@@ -0,0 +1,166 @@
1
+ [![Build Status](https://travis-ci.org/NodeRedis/node-redis-parser.png?branch=master)](https://travis-ci.org/NodeRedis/node-redis-parser)
2
+ [![Test Coverage](https://codeclimate.com/github/NodeRedis/node-redis-parser/badges/coverage.svg)](https://codeclimate.com/github/NodeRedis/node-redis-parser/coverage)
3
+ [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)
4
+
5
+ # redis-parser
6
+
7
+ A high performance javascript redis parser built for [node_redis](https://github.com/NodeRedis/node_redis) and [ioredis](https://github.com/luin/ioredis). Parses all [RESP](http://redis.io/topics/protocol) data.
8
+
9
+ ## Install
10
+
11
+ Install with [NPM](https://npmjs.org/):
12
+
13
+ npm install redis-parser
14
+
15
+ ## Usage
16
+
17
+ ```js
18
+ const Parser = require('redis-parser');
19
+
20
+ const myParser = new Parser(options);
21
+ ```
22
+
23
+ ### Options
24
+
25
+ * `returnReply`: *function*; mandatory
26
+ * `returnError`: *function*; mandatory
27
+ * `returnFatalError`: *function*; optional, defaults to the returnError function
28
+ * `returnBuffers`: *boolean*; optional, defaults to false
29
+ * `stringNumbers`: *boolean*; optional, defaults to false
30
+
31
+ ### Functions
32
+
33
+ * `reset()`: reset the parser to it's initial state
34
+ * `setReturnBuffers(boolean)`: set the returnBuffers option on/off without resetting the parser
35
+ * `setStringNumbers(boolean)`: set the stringNumbers option on/off without resetting the parser
36
+
37
+ ### Error classes
38
+
39
+ * `RedisError` sub class of Error
40
+ * `ReplyError` sub class of RedisError
41
+ * `ParserError` sub class of RedisError
42
+
43
+ All Redis errors will be returned as `ReplyErrors` while a parser error is returned as `ParserError`.
44
+ All error classes can be imported by the npm `redis-errors` package.
45
+
46
+ ### Example
47
+
48
+ ```js
49
+ const Parser = require("redis-parser");
50
+
51
+ class Library {
52
+ returnReply(reply) { /* ... */ }
53
+ returnError(err) { /* ... */ }
54
+ returnFatalError(err) { /* ... */ }
55
+
56
+ streamHandler() {
57
+ this.stream.on('data', (buffer) => {
58
+ // Here the data (e.g. `Buffer.from('$5\r\nHello\r\n'`))
59
+ // is passed to the parser and the result is passed to
60
+ // either function depending on the provided data.
61
+ parser.execute(buffer);
62
+ });
63
+ }
64
+ }
65
+
66
+ const lib = new Library();
67
+
68
+ const parser = new Parser({
69
+ returnReply(reply) {
70
+ lib.returnReply(reply);
71
+ },
72
+ returnError(err) {
73
+ lib.returnError(err);
74
+ },
75
+ returnFatalError(err) {
76
+ lib.returnFatalError(err);
77
+ }
78
+ });
79
+ ```
80
+
81
+ You do not have to use the returnFatalError function. Fatal errors will be returned in the normal error function in that case.
82
+
83
+ And if you want to return buffers instead of strings, you can do this by adding the `returnBuffers` option.
84
+
85
+ If you handle with big numbers that are to large for JS (Number.MAX_SAFE_INTEGER === 2^53 - 16) please use the `stringNumbers` option. That way all numbers are going to be returned as String and you can handle them safely.
86
+
87
+ ```js
88
+ // Same functions as in the first example
89
+
90
+ const parser = new Parser({
91
+ returnReply(reply) {
92
+ lib.returnReply(reply);
93
+ },
94
+ returnError(err) {
95
+ lib.returnError(err);
96
+ },
97
+ returnBuffers: true, // All strings are returned as Buffer e.g. <Buffer 48 65 6c 6c 6f>
98
+ stringNumbers: true // All numbers are returned as String
99
+ });
100
+
101
+ // The streamHandler as above
102
+ ```
103
+
104
+ ## Protocol errors
105
+
106
+ To handle protocol errors (this is very unlikely to happen) gracefully you should add the returnFatalError option, reject any still running command (they might have been processed properly but the reply is just wrong), destroy the socket and reconnect. Note that while doing this no new command may be added, so all new commands have to be buffered in the meantime, otherwise a chunk might still contain partial data of a following command that was already processed properly but answered in the same chunk as the command that resulted in the protocol error.
107
+
108
+ ## Contribute
109
+
110
+ The parser is highly optimized but there may still be further optimizations possible.
111
+
112
+ npm install
113
+ npm test
114
+ npm run benchmark
115
+
116
+ Currently the benchmark compares the performance against the hiredis parser:
117
+
118
+ HIREDIS: $ multiple chunks in a bulk string x 994,387 ops/sec ±0.22% (554 runs sampled)
119
+ JS PARSER: $ multiple chunks in a bulk string x 1,010,728 ops/sec ±0.28% (559 runs sampled)
120
+ HIREDIS BUF: $ multiple chunks in a bulk string x 648,742 ops/sec ±0.80% (526 runs sampled)
121
+ JS PARSER BUF: $ multiple chunks in a bulk string x 1,728,849 ops/sec ±0.41% (555 runs sampled)
122
+
123
+ HIREDIS: + multiple chunks in a string x 1,861,132 ops/sec ±0.18% (564 runs sampled)
124
+ JS PARSER: + multiple chunks in a string x 2,131,892 ops/sec ±0.31% (558 runs sampled)
125
+ HIREDIS BUF: + multiple chunks in a string x 965,132 ops/sec ±0.58% (521 runs sampled)
126
+ JS PARSER BUF: + multiple chunks in a string x 2,304,482 ops/sec ±0.31% (559 runs sampled)
127
+
128
+ HIREDIS: $ 4mb bulk string x 269 ops/sec ±0.56% (452 runs sampled)
129
+ JS PARSER: $ 4mb bulk string x 763 ops/sec ±0.25% (466 runs sampled)
130
+ HIREDIS BUF: $ 4mb bulk string x 336 ops/sec ±0.59% (459 runs sampled)
131
+ JS PARSER BUF: $ 4mb bulk string x 994 ops/sec ±0.36% (482 runs sampled)
132
+
133
+ HIREDIS: + simple string x 2,504,305 ops/sec ±0.19% (563 runs sampled)
134
+ JS PARSER: + simple string x 5,121,952 ops/sec ±0.30% (560 runs sampled)
135
+ HIREDIS BUF: + simple string x 1,122,899 ops/sec ±0.52% (516 runs sampled)
136
+ JS PARSER BUF: + simple string x 5,907,323 ops/sec ±0.23% (562 runs sampled)
137
+
138
+ HIREDIS: : integer x 2,461,376 ops/sec ±0.14% (561 runs sampled)
139
+ JS PARSER: : integer x 18,543,688 ops/sec ±0.19% (539 runs sampled)
140
+ JS PARSER STR: : integer x 14,149,305 ops/sec ±0.24% (561 runs sampled)
141
+
142
+ HIREDIS: : big integer x 2,114,270 ops/sec ±0.15% (561 runs sampled)
143
+ JS PARSER: : big integer x 10,794,439 ops/sec ±0.25% (560 runs sampled)
144
+ JS PARSER STR: : big integer x 4,594,807 ops/sec ±0.24% (558 runs sampled)
145
+
146
+ HIREDIS: * array x 45,597 ops/sec ±0.23% (565 runs sampled)
147
+ JS PARSER: * array x 68,396 ops/sec ±0.30% (563 runs sampled)
148
+ HIREDIS BUF: * array x 14,726 ops/sec ±0.39% (498 runs sampled)
149
+ JS PARSER BUF: * array x 80,961 ops/sec ±0.25% (561 runs sampled)
150
+
151
+ HIREDIS: * big nested array x 212 ops/sec ±0.17% (511 runs sampled)
152
+ JS PARSER: * big nested array x 243 ops/sec ±0.21% (496 runs sampled)
153
+ HIREDIS BUF: * big nested array x 207 ops/sec ±0.37% (430 runs sampled)
154
+ JS PARSER BUF: * big nested array x 297 ops/sec ±1.10% (421 runs sampled)
155
+
156
+ HIREDIS: - error x 168,761 ops/sec ±0.28% (559 runs sampled)
157
+ JS PARSER: - error x 424,257 ops/sec ±0.28% (557 runs sampled)
158
+
159
+ Platform info:
160
+ Ubuntu 17.04
161
+ Node.js 7.10.0
162
+ Intel(R) Core(TM) i7-5600U CPU
163
+
164
+ ## License
165
+
166
+ [MIT](./LICENSE)
@@ -0,0 +1,156 @@
1
+ # Changelog
2
+
3
+ ## v.3.0.0 - 25 May, 2017
4
+
5
+ Breaking Changes
6
+
7
+ - Drop support for Node.js < 4
8
+ - Removed support for hiredis completely
9
+
10
+ Internals
11
+
12
+ - Due to the changes to ES6 the error performance improved by factor 2-3x
13
+ - Improved length calculation performance (bulk strings + arrays)
14
+
15
+ Features
16
+
17
+ - The parser now handles weird input graceful
18
+
19
+ ## v.2.6.0 - 03 Apr, 2017
20
+
21
+ Internals
22
+
23
+ - Use Buffer.allocUnsafe instead of new Buffer() with modern Node.js versions
24
+
25
+ ## v.2.5.0 - 11 Mar, 2017
26
+
27
+ Features
28
+
29
+ - Added a `ParserError` class to differentiate them to ReplyErrors. The class is also exported
30
+
31
+ Bugfixes
32
+
33
+ - All errors now show their error message again next to the error name in the stack trace
34
+ - ParserErrors now show the offset and buffer attributes while being logged
35
+
36
+ ## v.2.4.1 - 05 Feb, 2017
37
+
38
+ Bugfixes
39
+
40
+ - Fixed minimal memory consumption overhead for chunked buffers
41
+
42
+ ## v.2.4.0 - 25 Jan, 2017
43
+
44
+ Features
45
+
46
+ - Added `reset` function to reset the parser to it's initial values
47
+ - Added `setReturnBuffers` function to reset the returnBuffers option (Only for the JSParser)
48
+ - Added `setStringNumbers` function to reset the stringNumbers option (Only for the JSParser)
49
+ - All Errors are now of sub classes of the new `RedisError` class. It is also exported.
50
+ - Improved bulk string chunked data handling performance
51
+
52
+ Bugfixes
53
+
54
+ - Parsing time for big nested arrays is now linear
55
+
56
+ ## v.2.3.0 - 25 Nov, 2016
57
+
58
+ Features
59
+
60
+ - Parsing time for big arrays (e.g. 4mb+) is now linear and works well for arbitrary array sizes
61
+
62
+ This case is a magnitude faster than before
63
+
64
+ OLD STR: * big array x 1.09 ops/sec ±2.15% (7 runs sampled)
65
+ OLD BUF: * big array x 1.23 ops/sec ±2.67% (8 runs sampled)
66
+
67
+ NEW STR: * big array x 273 ops/sec ±2.09% (85 runs sampled)
68
+ NEW BUF: * big array x 259 ops/sec ±1.32% (85 runs sampled)
69
+ (~10mb array with 1000 entries)
70
+
71
+ ## v.2.2.0 - 18 Nov, 2016
72
+
73
+ Features
74
+
75
+ - Improve `stringNumbers` parsing performance by up to 100%
76
+
77
+ Bugfixes
78
+
79
+ - Do not unref the interval anymore due to issues with NodeJS
80
+
81
+ ## v.2.1.1 - 31 Oct, 2016
82
+
83
+ Bugfixes
84
+
85
+ - Remove erroneously added const to support Node.js 0.10
86
+
87
+ ## v.2.1.0 - 30 Oct, 2016
88
+
89
+ Features
90
+
91
+ - Improve parser errors by adding more detailed information to them
92
+ - Accept manipulated Object.prototypes
93
+ - Unref the interval if used
94
+
95
+ ## v.2.0.4 - 21 Jul, 2016
96
+
97
+ Bugfixes
98
+
99
+ - Fixed multi byte characters getting corrupted
100
+
101
+ ## v.2.0.3 - 17 Jun, 2016
102
+
103
+ Bugfixes
104
+
105
+ - Fixed parser not working with huge buffers (e.g. 300 MB)
106
+
107
+ ## v.2.0.2 - 08 Jun, 2016
108
+
109
+ Bugfixes
110
+
111
+ - Fixed parser with returnBuffers option returning corrupted data
112
+
113
+ ## v.2.0.1 - 04 Jun, 2016
114
+
115
+ Bugfixes
116
+
117
+ - Fixed multiple parsers working concurrently resulting in faulty data in some cases
118
+
119
+ ## v.2.0.0 - 29 May, 2016
120
+
121
+ The javascript parser got completely rewritten by [Michael Diarmid](https://github.com/Salakar) and [Ruben Bridgewater](https://github.com/BridgeAR) and is now a lot faster than the hiredis parser.
122
+ Therefore the hiredis parser was deprecated and should only be used for testing purposes and benchmarking comparison.
123
+
124
+ All Errors returned by the parser are from now on of class ReplyError
125
+
126
+ Features
127
+
128
+ - Improved performance by up to 15x as fast as before
129
+ - Improved options validation
130
+ - Added ReplyError Class
131
+ - Added parser benchmark
132
+ - Switched default parser from hiredis to JS, no matter if hiredis is installed or not
133
+
134
+ Removed
135
+
136
+ - Deprecated hiredis support
137
+
138
+ ## v.1.3.0 - 27 Mar, 2016
139
+
140
+ Features
141
+
142
+ - Added `auto` as parser name option to check what parser is available
143
+ - Non existing requested parsers falls back into auto mode instead of always choosing the JS parser
144
+
145
+ ## v.1.2.0 - 27 Mar, 2016
146
+
147
+ Features
148
+
149
+ - Added `stringNumbers` option to make sure all numbers are returned as string instead of a js number for precision
150
+ - The parser is from now on going to print warnings if a parser is explicitly requested that does not exist and gracefully chooses the JS parser
151
+
152
+ ## v.1.1.0 - 26 Jan, 2016
153
+
154
+ Features
155
+
156
+ - The parser is from now on going to reset itself on protocol errors
@@ -0,0 +1,3 @@
1
+ 'use strict'
2
+
3
+ module.exports = require('./lib/parser')