class Aggro::Handler::CreateAggregate
Private: Handler
for incoming command requests.
Public Instance Methods
call()
click to toggle source
# File lib/aggro/handler/create_aggregate.rb, line 5 def call local? ? handle_local : handle_foreign end
Private Instance Methods
add_to_channels()
click to toggle source
# File lib/aggro/handler/create_aggregate.rb, line 11 def add_to_channels channel = Channel.new(message.id, message.type) Aggro.channels[message.id] = channel end
exists_in_channels?()
click to toggle source
# File lib/aggro/handler/create_aggregate.rb, line 16 def exists_in_channels? Aggro.channels.keys.include?(message.id) end
handle_foreign()
click to toggle source
# File lib/aggro/handler/create_aggregate.rb, line 29 def handle_foreign Message::Ask.new locator.primary_node.id end
handle_local()
click to toggle source
# File lib/aggro/handler/create_aggregate.rb, line 20 def handle_local unless exists_in_channels? Aggro.store.create message.id, message.type add_to_channels end Message::OK.new end
local?()
click to toggle source
# File lib/aggro/handler/create_aggregate.rb, line 33 def local? locator.local? end
locator()
click to toggle source
# File lib/aggro/handler/create_aggregate.rb, line 37 def locator @locator ||= Locator.new(message.id) end