@@ -3,7 +3,7 @@ var tarantoolConstants = require('./const');
3
3
var net = require ( 'net' ) ;
4
4
var _ = require ( 'underscore' ) ;
5
5
var EventEmitter = require ( 'events' ) ;
6
- var msgpack = require ( 'msgpack' ) ;
6
+ var msgpack = require ( 'msgpack5' ) ( ) ;
7
7
var vow = require ( 'vow' ) ;
8
8
var crypto = require ( 'crypto' ) ;
9
9
var xor = require ( 'bitwise-xor' ) ;
@@ -128,7 +128,8 @@ TarantoolConnection.prototype._responseBufferTrack = function(buffer, length){
128
128
TarantoolConnection . prototype . _processResponse = function ( buffer ) {
129
129
// add fixarraymap with 2 objects before main object
130
130
var dataBuffer = Buffer . concat ( [ new Buffer ( [ 0x92 ] ) , buffer ] ) ;
131
- var obj = msgpack . unpack ( dataBuffer ) ;
131
+ var obj = msgpack . decode ( dataBuffer ) ;
132
+
132
133
var reqId = obj [ 0 ] [ 1 ] ;
133
134
for ( var i = 0 ; i < this . commandsQueue . length ; i ++ )
134
135
if ( this . commandsQueue [ i ] [ 1 ] == reqId )
@@ -205,11 +206,11 @@ TarantoolConnection.prototype.select = function(spaceId, indexId, limit, offset,
205
206
if ( iterator == 'all' )
206
207
key = [ ] ;
207
208
var buffered = {
208
- spaceId : msgpack . pack ( spaceId ) ,
209
- indexId : msgpack . pack ( indexId ) ,
210
- limit : msgpack . pack ( limit ) ,
211
- offset : msgpack . pack ( offset ) ,
212
- key : msgpack . pack ( key )
209
+ spaceId : msgpack . encode ( spaceId ) ,
210
+ indexId : msgpack . encode ( indexId ) ,
211
+ limit : msgpack . encode ( limit ) ,
212
+ offset : msgpack . encode ( offset ) ,
213
+ key : msgpack . encode ( key )
213
214
} ;
214
215
var body = Buffer . concat ( [ new Buffer ( [ 0x86 , tarantoolConstants . KeysCode . space_id ] ) , buffered . spaceId ,
215
216
new Buffer ( [ tarantoolConstants . KeysCode . index_id ] ) , buffered . indexId ,
@@ -229,9 +230,9 @@ TarantoolConnection.prototype.delete = function(spaceId, indexId, key){
229
230
var reqId = requestId . getId ( ) ;
230
231
var header = this . _header ( tarantoolConstants . RequestCode . rqDelete , reqId ) ;
231
232
var buffered = {
232
- spaceId : msgpack . pack ( spaceId ) ,
233
- indexId : msgpack . pack ( indexId ) ,
234
- key : msgpack . pack ( key )
233
+ spaceId : msgpack . encode ( spaceId ) ,
234
+ indexId : msgpack . encode ( indexId ) ,
235
+ key : msgpack . encode ( key )
235
236
} ;
236
237
var body = Buffer . concat ( [ new Buffer ( [ 0x86 , tarantoolConstants . KeysCode . space_id ] ) , buffered . spaceId ,
237
238
new Buffer ( [ tarantoolConstants . KeysCode . index_id ] ) , buffered . indexId ,
@@ -247,10 +248,10 @@ TarantoolConnection.prototype.update = function(spaceId, indexId, key, ops){
247
248
var reqId = requestId . getId ( ) ;
248
249
var header = this . _header ( tarantoolConstants . RequestCode . rqUpdate , reqId ) ;
249
250
var buffered = {
250
- spaceId : msgpack . pack ( spaceId ) ,
251
- indexId : msgpack . pack ( indexId ) ,
252
- ops : msgpack . pack ( ops ) ,
253
- key : msgpack . pack ( key )
251
+ spaceId : msgpack . encode ( spaceId ) ,
252
+ indexId : msgpack . encode ( indexId ) ,
253
+ ops : msgpack . encode ( ops ) ,
254
+ key : msgpack . encode ( key )
254
255
} ;
255
256
var body = Buffer . concat ( [ new Buffer ( [ 0x84 , tarantoolConstants . KeysCode . space_id ] ) , buffered . spaceId ,
256
257
new Buffer ( [ tarantoolConstants . KeysCode . index_id ] ) , buffered . indexId ,
@@ -269,8 +270,8 @@ TarantoolConnection.prototype.eval = function(expression, tuple){
269
270
var reqId = requestId . getId ( ) ;
270
271
var header = this . _header ( tarantoolConstants . RequestCode . rqEval , reqId ) ;
271
272
var buffered = {
272
- expression : msgpack . pack ( expression ) ,
273
- tuple : msgpack . pack ( tuple )
273
+ expression : msgpack . encode ( expression ) ,
274
+ tuple : msgpack . encode ( tuple )
274
275
} ;
275
276
var body = Buffer . concat ( [ new Buffer ( [ 0x82 , tarantoolConstants . KeysCode . expression ] ) , buffered . expression ,
276
277
new Buffer ( [ tarantoolConstants . KeysCode . tuple ] ) , buffered . tuple ] ) ;
@@ -284,8 +285,8 @@ TarantoolConnection.prototype.call = function(functionName, tuple){
284
285
var reqId = requestId . getId ( ) ;
285
286
var header = this . _header ( tarantoolConstants . RequestCode . rqCall , reqId ) ;
286
287
var buffered = {
287
- functionName : msgpack . pack ( functionName ) ,
288
- tuple : msgpack . pack ( tuple )
288
+ functionName : msgpack . encode ( functionName ) ,
289
+ tuple : msgpack . encode ( tuple )
289
290
} ;
290
291
var body = Buffer . concat ( [ new Buffer ( [ 0x82 , tarantoolConstants . KeysCode . function_name ] ) , buffered . functionName ,
291
292
new Buffer ( [ tarantoolConstants . KeysCode . tuple ] ) , buffered . tuple ] ) ;
@@ -309,8 +310,8 @@ TarantoolConnection.prototype._replaceInsert = function(cmd, reqId, spaceId, tup
309
310
if ( Array . isArray ( tuple ) ) {
310
311
var header = this . _header ( cmd , reqId ) ;
311
312
var buffered = {
312
- spaceId : msgpack . pack ( spaceId ) ,
313
- tuple : msgpack . pack ( tuple )
313
+ spaceId : msgpack . encode ( spaceId ) ,
314
+ tuple : msgpack . encode ( tuple )
314
315
} ;
315
316
var body = Buffer . concat ( [ new Buffer ( [ 0x82 , tarantoolConstants . KeysCode . space_id ] ) , buffered . spaceId ,
316
317
new Buffer ( [ tarantoolConstants . KeysCode . tuple ] ) , buffered . tuple ] ) ;
@@ -327,7 +328,7 @@ TarantoolConnection.prototype.auth = function(username, password){
327
328
var reqId = requestId . getId ( ) ;
328
329
var header = this . _header ( tarantoolConstants . RequestCode . rqAuth , reqId ) ;
329
330
var buffered = {
330
- username : msgpack . pack ( username )
331
+ username : msgpack . encode ( username )
331
332
} ;
332
333
var scrambled = scramble ( password , this . salt ) ;
333
334
var body = Buffer . concat ( [ new Buffer ( [ 0x82 , tarantoolConstants . KeysCode . username ] ) , buffered . username ,
0 commit comments