droonga / express-droonga

A framework for building scalable realtime web API services
https://npmjs.org/package/express-droonga
MIT License
5 stars 2 forks source link

Change API of connection model #16

Closed piroor closed 11 years ago

piroor commented 11 years ago

Before:

new model.REST({
  toBackend: function(event, request) {
     ...
     return (converted request to the droonga cluster);
  },
  toClient: function(event, response) {
     ...
     return (converted response to the client);
  }
})

new model.RequestResponse({
  toBackend: function(event, requestData) {
     ...
     return (converted requestData to the droonga cluster);
  },
  toClient: function(event, responseData) {
     ...
     return (converted responseData to the client);
  }
})

After:

new command.HTTP({
  onRequest: function(httpRequest, wrappedDroongaClusterClient) {
     ...
     wrappedDroongaClusterClient.emit(message to the droonga cluster);
  },
  onResponse: function(responseData, wrappedHttpResponse) {
     ...
     wrappedHttpResponse.send(...);
  }
})

new command.RequestResponse({
  onRequest: function(requestData, wrappedDroongaClusterClient) {
     ...
     wrappedDroongaClusterClient.emit(data built from requestData);
  },
  onResponse: function(responseData, wrappedSocketIOClient) {
     ...
     wrappedSocketIOClient.emit(data built from responseData);
  }
})
piroor commented 11 years ago

Done.