Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable to separate tuple space from client side.
- Loading branch information
Showing
16 changed files
with
346 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/usr/bin/env ruby | ||
# -*- ruby -*- | ||
|
||
require 'pione' | ||
require 'pione/front/tuple-space-broker-front' | ||
require 'pione/command/pione-tuple-space-broker' | ||
|
||
Pione::Command::PioneTupleSpaceBroker.run(ARGV) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
module Pione | ||
module Agent | ||
# TupleSpaceTerminator is an agent that terminates tuple space's life. | ||
class TupleSpaceTerminator < TupleSpaceClient | ||
set_agent_type :tuple_space_terminator, self | ||
|
||
def initialize(tuple_space, &b) | ||
super(tuple_space) | ||
@action = b | ||
end | ||
|
||
# | ||
# transition definitions | ||
# | ||
|
||
define_transition :wait | ||
|
||
chain :init => :wait | ||
chain :wait => :terminate | ||
|
||
# | ||
# transition methods | ||
# | ||
|
||
def transit_to_wait | ||
read(TupleSpace::CommandTuple.new(name: "terminate-tuple-space")) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
module Pione | ||
module Command | ||
# `PioneTupleSpaceBroker` is for `pione-tuple-space-broker` command. | ||
class PioneTupleSpaceBroker < BasicCommand | ||
# | ||
# informations | ||
# | ||
|
||
define(:toplevel, true) | ||
define(:name, "pione-tuple-space-broker") | ||
define(:desc, "run tuple space provider agent") | ||
define(:front, Pione::Front::TupleSpaceBrokerFront) | ||
|
||
# | ||
# options | ||
# | ||
|
||
option CommonOption.color | ||
option CommonOption.debug | ||
option CommonOption.communication_address | ||
option CommonOption.parent_front | ||
option NotificationOption.notification_targets | ||
|
||
# | ||
# command lifecycle: setup phase | ||
# | ||
|
||
phase(:setup) do |item| | ||
item.configure(:timeout => 5) | ||
|
||
item << ProcessAction.connect_parent | ||
item << :tuple_space_manager | ||
end | ||
|
||
setup(:tuple_space_manager) do |item| | ||
item.process do | ||
model[:tuple_space_manager] = TupleSpace::Manager.new(self) | ||
end | ||
end | ||
|
||
# | ||
# command lifecycle: execution phase | ||
# | ||
|
||
phase(:execution) do |seq| | ||
seq << :banner | ||
seq << :sleep | ||
end | ||
|
||
execution(:banner) do |item| | ||
item.process do | ||
Log::SystemLog.info("Start tuple space broker.") | ||
end | ||
end | ||
|
||
execution(:sleep) do |item| | ||
item.process { sleep } | ||
end | ||
|
||
# | ||
# command lifecycle: termination phase | ||
# | ||
|
||
phase(:termination) do |seq| | ||
seq.configure(:timeout => 5) | ||
|
||
seq << ProcessAction.terminate_children | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.