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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.