Warning: partly this is a blatant plug for Net::Distributed ... I am feeling unloved. I promise to answer some newbie questions if someone will look at my newbie code. Anyway, I also think it is an interesting question.
OK. So I have a Net::Distributed class, which allows peers to talk to each other. The class itself is (1) a facade which is easy for clients to talk to, and (2) a transport which provides methods for sending and receiving messages. To handle messages, you load Net::Distributed::Handler objects. These may also export some utility methods... for example a Net::Distributed::Handler::Joiner will provide a send_join_request method as well as doing the handle_join_request from within its own package.
I want to let nodes migrate. That is, if a node is about to be destroyed, it should be able to nip off to another peer, fork and start running at a new address. Groovy. (Assume that I have the security issues covered ->koff<-)
So I've created a Net::Distributed::Handler::Migrator object. It handles migration requests, and also provides default methods for migrating, and for setting up a child. So far so good.
The problem is that the child has to have a new address. It can't have exactly the same address as the old one (otherwise messages would get to them both.) Only the Net::Distributed object can provide the address, because only it knows what an address is - it provides the message transport layer, remember? But if I add these class-specific methods into Net::Distributed, I am adding a load of code that is not really relevant unless you want to use a migration handler. And that's bad, and will make Net::Distributed hard to subclass. There are other parts of the migration process that are also specific to the Net::Distributed object.
So does anyone see a good way to handle this? How can I provide migration services, with a simple client interface, which still Do The Right Thing when a client migrates?
bw
dave hj~
In reply to Organizing my packages by dash2
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |