Navigation Menu

Skip to content

Commit

Permalink
Make NodeName's sender role easy to replace
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Apr 30, 2015
1 parent c8604ac commit 13947af
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/droonga/engine_node.rb
Expand Up @@ -125,7 +125,7 @@ def live?

def forwardable?
return false unless live?
role == NodeRole.mine
role == sender_role
end

def readable?
Expand All @@ -134,7 +134,7 @@ def readable?
end

def writable?
case NodeRole.mine
case sender_role
when NodeRole::SERVICE_PROVIDER
true
when NodeRole::ABSORB_SOURCE
Expand Down Expand Up @@ -182,6 +182,10 @@ def resume
end

private
def sender_role
NodeRole.mine
end

def have_unprocessed_messages?
@state and @state["have_unprocessed_messages"]
end
Expand Down Expand Up @@ -217,7 +221,7 @@ def complete_service_provider?

def really_writable?
return false unless writable?
case NodeRole.mine
case sender_role
when NodeRole::SERVICE_PROVIDER
service_provider?
when NodeRole::ABSORB_SOURCE
Expand Down

0 comments on commit 13947af

Please sign in to comment.