Skip to content

Commit

Permalink
Fix documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
eprochasson committed Mar 25, 2011
1 parent 31e0256 commit 97cf3e9
Showing 1 changed file with 33 additions and 12 deletions.
45 changes: 33 additions & 12 deletions lib/backplane/memoryMessageStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,9 @@ module.exports = (function(){
my.save = function(bus,channel,content){
/**
* @method save
* @param {bus,channel,content}
* @param {bus}: bus where the channel you want to post to lies
* @param {channel}: channel where to post the message
* @param {content}: message to post
* @return null
* bus : must be a valid, existing bus
* channel : if it does not exist, it will be created before pushing the message (MUST be base64 encoded)
Expand All @@ -209,13 +211,31 @@ module.exports = (function(){
}
};

my.addBus = function(bus){
/**
* @method addBus
* @param {bus} bus: the bus to be created (string)
*/
my.store.addBus(bus);
}

my.addChannel = function(bus,channel){
/**
* @method addChannel
* @param {bus} bus: bus on top of which to create the channel (string)
* @param {channel} channel: channel to create (string)
*/
my.store.addChannel(bus,channel)
}

my.getChannelMessages = function(bus,channel,options,callback){
/**
* Retrieve messages from a given channel
* @method getChannelMessages
* @param {bus,channel,options,callback}
* Get messages from a given bus/channel
* options : to specify a "since" parameter (ONLY supported parameter for now)
* callback : function(message,error). message: retrieved message from channel, error: potential errors.
* @param {bus}: bus where the channel lies
* @param {channel}: channel to retrieve the messages from
* @param {options}: allows to pass a "since" parameter, indicating the id of the last message retrieved before. Method will return new messages published since "since" (unless "since" is too old, in which case it will retrieve all messages in the queue).
* @param {callback}: callback method. Will be called as callback(message,error)
*/
if(!my.store.isValidChannel(bus,channel)){
callback(null,{ name: "Invalid bus/channel exception", message: "Attempt to read an invalid bus/channel"});
Expand All @@ -227,11 +247,11 @@ module.exports = (function(){

my.getBusMessages = function(bus,options,callback){
/**
* Retrieve messages from all the channel of a given bus
* @method getBusMessages
* @param {bus,options,callback}
* Get messages from all the channel of a given bus
* options : to specify a "since" parameter (ONLY supported parameter for now)
* callback : function(message,error). message: retrieved message from channel, error: potential errors.
* @param {bus}: bus from which to retrive messages
* @param {options}:allows to pass a "since" parameter, indicating the id of the last message retrieved before. Method will return new messages published since "since" (unless "since" is too old, in which case it will retrieve all messages in the queue).
* @param {callback}: callback method. Will be called as callback(message,error)
*/
if(!my.store.isValidBus(bus)){
callback(null,{ name: "Invalid bus exception", message: "Attempt to read an invalid bus"});
Expand All @@ -244,7 +264,7 @@ module.exports = (function(){
my.validate = function(message){
/**
* @method validate
* @param {message}
* @param {message}: message to be validated
* check that message is a proper Backplane message with source, type and payload
*/
if(!message.source || !message.payload || !message.type){
Expand All @@ -259,7 +279,8 @@ module.exports = (function(){
my.delChannel = function(bus,channel){
/**
* @method delChannel
* @param {bus, channel}
* @param {bus}: bus where the channel to be deleted lies
* @param {channel}: channel to remove
* delete the channel
* the channel MUST exist
*/
Expand All @@ -269,7 +290,7 @@ module.exports = (function(){
my.delBus = function(bus){
/**
* @method delBus
* @param {bus}
* @param {bus}: bus to be deleted
* delete the bus
* the bus MUST exist
*/
Expand Down

0 comments on commit 97cf3e9

Please sign in to comment.