Sha256: 6cb8b49e6223411bcadf0a9e7668b95fa62e8a10f0467accd043446606e99b2b
Contents?: true
Size: 871 Bytes
Versions: 3
Compression:
Stored size: 871 Bytes
Contents
module Aggro module Handler # Private: Handler for incoming command requests. class CreateAggregate < Struct.new(:message, :server) def call local? ? handle_local : handle_foreign end private def add_to_channels channel = Channel.new(message.id, message.type) Aggro.channels[message.id] = channel end def exists_in_channels? Aggro.channels.keys.include?(message.id) end def handle_local unless exists_in_channels? Aggro.store.create message.id, message.type add_to_channels end Message::OK.new end def handle_foreign Message::Ask.new locator.primary_node.id end def local? locator.local? end def locator @locator ||= Locator.new(message.id) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
aggro-0.0.4 | lib/aggro/handler/create_aggregate.rb |
aggro-0.0.3 | lib/aggro/handler/create_aggregate.rb |
aggro-0.0.2 | lib/aggro/handler/create_aggregate.rb |