forked from celluloid/dcell
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dcell: attempt to use msgpack for RPC v1
- Loading branch information
Showing
15 changed files
with
156 additions
and
412 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
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 |
---|---|---|
@@ -1,30 +1,18 @@ | ||
module DCell | ||
# Proxy object for actors that live on remote nodes | ||
class CellProxy < Celluloid::CellProxy; end | ||
|
||
class ThreadHandleProxy | ||
def kill | ||
raise NotImplementedError, "remote kill not supported" | ||
end | ||
|
||
def join(timeout) | ||
raise NotImplementedError, "remote join not supported" | ||
class ActorProxy | ||
def initialize(dnode, rmailbox) | ||
@dnode, @rmailbox = dnode, rmailbox | ||
end | ||
end | ||
|
||
class SubjectProxy | ||
def class | ||
"[remote]" | ||
end | ||
end | ||
|
||
class Actor | ||
def initialize(mailbox) | ||
@mailbox = mailbox | ||
@thread = ThreadHandleProxy.new | ||
@subject = SubjectProxy.new | ||
@proxy = Celluloid::ActorProxy.new(@thread, @mailbox) | ||
def method_missing(meth, *args, &block) | ||
message = {:mailbox => @rmailbox, :meth => meth, :args => args, :block => block_given?} | ||
res = @dnode.send_request Message::Relay.new(Thread.mailbox, message) | ||
if block_given? | ||
yield res | ||
else | ||
res | ||
end | ||
end | ||
attr_reader :mailbox, :thread, :subject, :proxy | ||
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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.