class Redis::Distributed

def ensure_same_node(command, keys)

def ensure_same_node(command, keys)
  all = true
  tags = keys.map do |key|
    tag = key_tag(key)
    all = false unless tag
    tag
  end
  if (all && tags.uniq.size != 1) || (!all && keys.uniq.size != 1)
    # Not 1 unique tag or not 1 unique key
    raise CannotDistribute, command
  end
  yield(node_for(keys.first))
end