Navigation Menu

Skip to content

Commit

Permalink
Make Cluster easy to tested
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Apr 30, 2015
1 parent 3ce8c81 commit bed18d8
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions lib/droonga/cluster.rb
Expand Up @@ -68,7 +68,10 @@ def initialize(params)

@params = params
@catalog = params[:catalog]
@state = nil
@state = params[:state] || {}

@engine_nodes = nil
@on_change = nil

reload
end
Expand Down Expand Up @@ -221,14 +224,17 @@ def all_node_names
def create_engine_nodes
all_node_names.collect do |name|
node_state = @state[name] || {}
EngineNode.new(:loop => @loop,
:name => name,
:state => node_state,
:auto_close_timeout =>
@params[:internal_connection_lifetime])
create_engine_node(:name => name,
:state => node_state)
end
end

def create_engine_node(params)
EngineNode.new(params.merge(:loop => @loop,
:auto_close_timeout =>
@params[:internal_connection_lifetime]))
end

def log_tag
"cluster_state"
end
Expand Down

0 comments on commit bed18d8

Please sign in to comment.