Skip to content

Commit

Permalink
Licence, version and translation fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
agsh committed Dec 4, 2014
1 parent 97d921d commit c824eda
Showing 1 changed file with 20 additions and 22 deletions.
42 changes: 20 additions & 22 deletions boobst.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
/**
* Boobst module (boobst.js)
* Маленький клиент для работы с СУБД Cache'
* Для отладки используйте метод .emit('debug')
* A tiny database driver for DBMS Cache'
* @author Andrew D. Laptev <[email protected]>
* @version 0.8.4
* @license AGPL
* @version 0.8.14
* @license MIT
**/

var net = require('net')
Expand Down Expand Up @@ -44,8 +43,7 @@ const
* @private
*/
function onConnection() {
// в новых версиях протокола при коннекте сервер отдаёт приветствие
// так что callback'и теперь вызываются при обработке команды BCMD.HI
// unused event handler cause on connection server first of all sends greeting BCMD.HI to client
}

/**
Expand Down Expand Up @@ -192,7 +190,7 @@ var BoobstSocket = function(options) {
this.socket.on('error', onError.bind(this));
};

// наследуемся от events.EventEmitter
// events.EventEmitter inheritance
util.inherits(BoobstSocket, events.EventEmitter);

/**
Expand Down Expand Up @@ -224,10 +222,10 @@ BoobstSocket.prototype.connect = function(callback) {
/**
* Common event handler
* @private
* @param {Buffer} data data chunk
* @param {Buffer} data binary data chunk
*/
BoobstSocket.prototype.onDataCommon = function(data) {
// проверяем, является ли этот чанк последним куском передаваемых данных
// check if this chunk is the last one
// it must have \6\6 characters at the end
if ((data.length > 1) && (data[data.length - 1] === 6) && (data[data.length - 2] === 6)) {
if (this.out && (this.command === BCMD.EXECUTE || this.command === BCMD.XECUTE)){ // if we're writing into stream
Expand Down Expand Up @@ -258,7 +256,7 @@ BoobstSocket.prototype.onDataCommon = function(data) {
/**
* Connect event handler
* @private
* @param {Buffer} data greeting
* @param {Buffer} data greeting
*/
BoobstSocket.prototype.onDataGreeting = function(data) {
this.emit('debug', 'connected');
Expand All @@ -273,9 +271,9 @@ BoobstSocket.prototype.onDataGreeting = function(data) {
return;
}

// работаем с нужной нам версией протокола
// working with properly protocol version
this.id = parseInt(dataStr[1], 10);
// если при подключении мы находимся в отличной области, первым делом переключимся в нужную
// if we're in the different namespace when connected just switch to the right one
if (this.ns) {
if (this.ns !== dataStr[2]) {
this.queue.unshift({
Expand All @@ -299,7 +297,7 @@ BoobstSocket.prototype.onDataGreeting = function(data) {
};

/**
* Обработчик данных, пришедших от сервера при смене namespace
* Namespace change event handler
* @private
* @param {buffer.Buffer} data информация о смене
*/
Expand Down Expand Up @@ -514,10 +512,10 @@ BoobstSocket.prototype.setEncoding = function(value, callback) {
};

/**
* Установить значение переменной или глобала
* @param {string} name имя переменной или глобала (начинается с ^)
* Set the value of variable or global
* @param {string} name variable or global name (global name starts with `^`)
* @param {string|Buffer|Array<string>} [subscripts]
* @param {string|Buffer|function} value значение переменной
* @param {string|Buffer|function} value variable value
* @param {?function(this:boobst.BoobstSocket, (null|Error), string)} [callback] callback
* @return {boobst.BoobstSocket|BoobstSocket}
*/
Expand Down Expand Up @@ -616,9 +614,9 @@ BoobstSocket.prototype.set = function(name, subscripts, value, callback) {

/**
* Save javascript-оbject in Cache'
* @param {string} name имя переменной или глобала (начинается с ^)
* @param {string} variable or global name (global name starts with `^`)
* @param {Array.<string>} [subscripts]
* @param {Object} object js-объект
* @param {Object} object javascript-object
* @param {function(?Error)} [callback] callback
* @deprecated
*/
Expand All @@ -642,7 +640,7 @@ BoobstSocket.prototype.order = BoobstSocket.prototype.next = function(name, subs

/**
* Changes namespace
* @param {string} name Существующий namespace
* @param {string} name existing namespace
* @param {function} [callback] callback
*/
BoobstSocket.prototype.zn = function(name, callback) {
Expand Down Expand Up @@ -690,8 +688,8 @@ BoobstSocket.prototype.kill = function(name, subscripts, callback) {

/**
* Send binary data
* @param {string} uri uri format is: file://<file_path> или global://<global_name_w/o_^>
* @param {Stream} stream поток данных
* @param {string} uri uri format is: file://<file_path> or global://<global_name_w/o_^>
* @param {Stream} stream data stream
* @param {function(this:boobst.BoobstSocket, (null|Error))} [callback] callback
*/
BoobstSocket.prototype.blob = function(uri, stream, callback) {
Expand All @@ -712,7 +710,7 @@ BoobstSocket.prototype.blob = function(uri, stream, callback) {
};

/**
* Очистить локальное пространство имён и проинициализировать серверные переменные заново
* Clear the local namespace and set the server variables again
* @param {function(this:boobst.BoobstSocket, (null|Error))} [callback] callback
*/
BoobstSocket.prototype.flush = function(callback) {
Expand Down

0 comments on commit c824eda

Please sign in to comment.