Skip to content

Instantly share code, notes, and snippets.

@amfeng
Created November 3, 2011 17:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amfeng/1337150 to your computer and use it in GitHub Desktop.
Save amfeng/1337150 to your computer and use it in GitHub Desktop.
# Want to have Membership separate, so can plug in different Membership modules on the fly
# Check number of members in the beginning, when find winner, consult current state of member table OR have vote_status = currently voting
module VoteMasterProtocol
state do
interface input :begin_vote, [:ballotid, :content, :ratio]
interface output, :result, [:ballotid, :result]
end
end
module VoteAgentProtocol
state do
interface input, :cast_vote, [:ballotid] => [:response]
end
end
module VoteProtocol
state do
# TODO: Do we want to use multicast? Timeouts?
# 1) Keep as channels, except duplicate multicast functionality
# 2) Use multicast, have two sets of ballot/vote interfaces, and
# code the bridging ourselves
# 3)
interface input, :ballot, [:ballotid, :content]
interface input, :vote, [:ballotid, :response]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment