@@ -3,7 +3,7 @@ var tarantoolConstants = require('./const');
33var net = require ( 'net' ) ;
44var _ = require ( 'underscore' ) ;
55var EventEmitter = require ( 'events' ) ;
6- var msgpack = require ( 'msgpack' ) ;
6+ var msgpack = require ( 'msgpack5' ) ( ) ;
77var vow = require ( 'vow' ) ;
88var crypto = require ( 'crypto' ) ;
99var xor = require ( 'bitwise-xor' ) ;
@@ -128,7 +128,8 @@ TarantoolConnection.prototype._responseBufferTrack = function(buffer, length){
128128TarantoolConnection . prototype . _processResponse = function ( buffer ) {
129129 // add fixarraymap with 2 objects before main object
130130 var dataBuffer = Buffer . concat ( [ new Buffer ( [ 0x92 ] ) , buffer ] ) ;
131- var obj = msgpack . unpack ( dataBuffer ) ;
131+ var obj = msgpack . decode ( dataBuffer ) ;
132+
132133 var reqId = obj [ 0 ] [ 1 ] ;
133134 for ( var i = 0 ; i < this . commandsQueue . length ; i ++ )
134135 if ( this . commandsQueue [ i ] [ 1 ] == reqId )
@@ -205,11 +206,11 @@ TarantoolConnection.prototype.select = function(spaceId, indexId, limit, offset,
205206 if ( iterator == 'all' )
206207 key = [ ] ;
207208 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 )
213214 } ;
214215 var body = Buffer . concat ( [ new Buffer ( [ 0x86 , tarantoolConstants . KeysCode . space_id ] ) , buffered . spaceId ,
215216 new Buffer ( [ tarantoolConstants . KeysCode . index_id ] ) , buffered . indexId ,
@@ -229,9 +230,9 @@ TarantoolConnection.prototype.delete = function(spaceId, indexId, key){
229230 var reqId = requestId . getId ( ) ;
230231 var header = this . _header ( tarantoolConstants . RequestCode . rqDelete , reqId ) ;
231232 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 )
235236 } ;
236237 var body = Buffer . concat ( [ new Buffer ( [ 0x86 , tarantoolConstants . KeysCode . space_id ] ) , buffered . spaceId ,
237238 new Buffer ( [ tarantoolConstants . KeysCode . index_id ] ) , buffered . indexId ,
@@ -247,10 +248,10 @@ TarantoolConnection.prototype.update = function(spaceId, indexId, key, ops){
247248 var reqId = requestId . getId ( ) ;
248249 var header = this . _header ( tarantoolConstants . RequestCode . rqUpdate , reqId ) ;
249250 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 )
254255 } ;
255256 var body = Buffer . concat ( [ new Buffer ( [ 0x84 , tarantoolConstants . KeysCode . space_id ] ) , buffered . spaceId ,
256257 new Buffer ( [ tarantoolConstants . KeysCode . index_id ] ) , buffered . indexId ,
@@ -269,8 +270,8 @@ TarantoolConnection.prototype.eval = function(expression, tuple){
269270 var reqId = requestId . getId ( ) ;
270271 var header = this . _header ( tarantoolConstants . RequestCode . rqEval , reqId ) ;
271272 var buffered = {
272- expression : msgpack . pack ( expression ) ,
273- tuple : msgpack . pack ( tuple )
273+ expression : msgpack . encode ( expression ) ,
274+ tuple : msgpack . encode ( tuple )
274275 } ;
275276 var body = Buffer . concat ( [ new Buffer ( [ 0x82 , tarantoolConstants . KeysCode . expression ] ) , buffered . expression ,
276277 new Buffer ( [ tarantoolConstants . KeysCode . tuple ] ) , buffered . tuple ] ) ;
@@ -284,8 +285,8 @@ TarantoolConnection.prototype.call = function(functionName, tuple){
284285 var reqId = requestId . getId ( ) ;
285286 var header = this . _header ( tarantoolConstants . RequestCode . rqCall , reqId ) ;
286287 var buffered = {
287- functionName : msgpack . pack ( functionName ) ,
288- tuple : msgpack . pack ( tuple )
288+ functionName : msgpack . encode ( functionName ) ,
289+ tuple : msgpack . encode ( tuple )
289290 } ;
290291 var body = Buffer . concat ( [ new Buffer ( [ 0x82 , tarantoolConstants . KeysCode . function_name ] ) , buffered . functionName ,
291292 new Buffer ( [ tarantoolConstants . KeysCode . tuple ] ) , buffered . tuple ] ) ;
@@ -309,8 +310,8 @@ TarantoolConnection.prototype._replaceInsert = function(cmd, reqId, spaceId, tup
309310 if ( Array . isArray ( tuple ) ) {
310311 var header = this . _header ( cmd , reqId ) ;
311312 var buffered = {
312- spaceId : msgpack . pack ( spaceId ) ,
313- tuple : msgpack . pack ( tuple )
313+ spaceId : msgpack . encode ( spaceId ) ,
314+ tuple : msgpack . encode ( tuple )
314315 } ;
315316 var body = Buffer . concat ( [ new Buffer ( [ 0x82 , tarantoolConstants . KeysCode . space_id ] ) , buffered . spaceId ,
316317 new Buffer ( [ tarantoolConstants . KeysCode . tuple ] ) , buffered . tuple ] ) ;
@@ -327,7 +328,7 @@ TarantoolConnection.prototype.auth = function(username, password){
327328 var reqId = requestId . getId ( ) ;
328329 var header = this . _header ( tarantoolConstants . RequestCode . rqAuth , reqId ) ;
329330 var buffered = {
330- username : msgpack . pack ( username )
331+ username : msgpack . encode ( username )
331332 } ;
332333 var scrambled = scramble ( password , this . salt ) ;
333334 var body = Buffer . concat ( [ new Buffer ( [ 0x82 , tarantoolConstants . KeysCode . username ] ) , buffered . username ,
0 commit comments