[Groonga-commit] groonga/express-droonga at a3a40b6 [master] Update default command definitions to the new style

Back to archive index

YUKI Hiroshi null+****@clear*****
Thu Aug 1 14:00:03 JST 2013


YUKI Hiroshi	2013-08-01 14:00:03 +0900 (Thu, 01 Aug 2013)

  New Revision: a3a40b6c7dd25d064c39f59a9b7a419c9a9796eb
  https://github.com/groonga/express-droonga/commit/a3a40b6c7dd25d064c39f59a9b7a419c9a9796eb

  Message:
    Update default command definitions to the new style

  Modified files:
    lib/adapter/api/groonga.js
    lib/adapter/api/rest.js

  Modified: lib/adapter/api/groonga.js (+2 -2)
===================================================================
--- lib/adapter/api/groonga.js    2013-08-01 13:55:32 +0900 (2f660f1)
+++ lib/adapter/api/groonga.js    2013-08-01 14:00:03 +0900 (0a24dff)
@@ -3,8 +3,8 @@ var command = require('../command');
 module.exports = {
   'groonga': new command.HTTPCommand({
     path: '/d/:commandName',
-    requestConverter: function(commandName, request) {
-      return [request.params.commandName, request.query];
+    onRequest: function(request, connection) {
+      connection.emit(request.params.commandName, request.query);
     }
   })
 };

  Modified: lib/adapter/api/rest.js (+23 -9)
===================================================================
--- lib/adapter/api/rest.js    2013-08-01 13:55:32 +0900 (a17627a)
+++ lib/adapter/api/rest.js    2013-08-01 14:00:03 +0900 (a1985fe)
@@ -4,42 +4,56 @@ var requestBuilders = require('./rest-request-builder');
 module.exports = {
 //  'status': new command.HTTPCommand({
 //    path: '/status/:target',
-//    requestConverter: requestBuilders.status
+//    onRequest: function(request, connection) {
+//      connection.emit('status', requestBuilders.status(request));
+//    }
 //  }),
   'search': new command.HTTPCommand({
     path: '/tables/:tableName',
-    requestConverter: function(event, request) {
-      return [event, requestBuilders.search(request)];
+    onRequest: function(request, connection) {
+      connection.emit('search', requestBuilders.search(request));
     }
   }) //,
 //  'createtable': new command.HTTPCommand({
 //    method: 'PUT',
 //    path: '/tables/:tableName',
-//    requestConverter: requestBuilders.createTable
+//    onRequest: function(request, connection) {
+//      connection.emit('createtable', requestBuilders.createTable(request));
+//    }
 //  }),
 //  'removetable': new command.HTTPCommand({
 //    method: 'DELETE',
 //    path: '/tables/:tableName',
-//    requestConverter: requestBuilders.removeTable
+//    onRequest: function(request, connection) {
+//      connection.emit('removetable', requestBuilders.removeTable(request));
+//    }
 //  }),
 //  'createcolumn': new command.HTTPCommand({
 //    method: 'PUT',
 //    path: '/tables/:tableName/columns/:columnName',
-//    requestConverter: requestBuilders.createColumn
+//    onRequest: function(request, connection) {
+//      connection.emit('createcolumn', requestBuilders.createColumn(request));
+//    }
 //  }),
 //  'removecolumn': new command.HTTPCommand({
 //    method: 'DELETE',
 //    path: '/tables/:tableName/columns/:columnName',
-//    requestConverter: requestBuilders.removeColumn
+//    onRequest: function(request, connection) {
+//      connection.emit('removecolumn', requestBuilders.removeColumn(request));
+//    }
 //  }),
 //  'loadrecord': new command.HTTPCommand({
 //    method: 'PUT',
 //    path: '/tables/:tableName/records/:key',
-//    requestConverter: requestBuilders.loadRecord
+//    onRequest: function(request, connection) {
+//      connection.emit('loadrecord', requestBuilders.loadRecord(request));
+//    }
 //  }),
 //  'loadrecords': new command.HTTPCommand({
 //    method: 'PUT',
 //    path: '/tables/:tableName/records',
-//    requestConverter: requestBuilders.loadRecords
+//    onRequest: function(request, connection) {
+//      connection.emit('loadrecords', requestBuilders.loadRecords(request));
+//    }
 //  })
 };
-------------- next part --------------
HTML����������������������������...
Télécharger 



More information about the Groonga-commit mailing list
Back to archive index