Sequences Protocol

4 views
Skip to first unread message

Kevin Yao

unread,
Nov 25, 2011, 6:44:08 PM11/25/11
to programthecloud
So after our discussion of the sequences protocol a week ago, I have
decided to tweak the protocol a little bit. Now one must initialize a
counter before one can increment it (seed). Also, instead of
restricting each increment to 1, we decided to add a step size so one
can increment by an arbitrary number. If anyone is against this
change, please speak up. Otherwise, we will go with this new
implementation.

module SequencesProtocol
state do
# initializes the counter for an id to a certain number. If the id
exists already, ignore request
# @param [String] ident the unique identifier of a row in a
collection of counts
# @param [Number] the starting count associated with the ident
interface input, :init_ident, [:ident]=>[:seed]

# increment the counter for an id by a number. Id must
have a current count already.
# @param [String] ident the unique identifier of a row in a
collection of counts
# @param [Number] the increment step size
interface input, :increment_count, [:ident]=>[:step]

# reset the counter for an id. In any implementation, the
row identified by ident should either be set to
# its initial value again, or no longer be in the collection of
counters.
# @param [String] ident the unique identifier of a row in a
collection of counts
interface input, :clear_ident, [:ident]

# continuously output the count of all existent id's.
# @param [String] ident the unique identifier of a row in a
collection of counts
# @param [Number] the count associated with the ident
interface output, :return_count, [:ident]=>[:tally]
end
end

Reply all
Reply to author
Forward
0 new messages