Rice Pastry API

rice.p2p.scribe.maintenance
Interface ScribeMaintenancePolicy

All Known Implementing Classes:
ScribeMaintenancePolicy.DefaultScribeMaintenancePolicy

public interface ScribeMaintenancePolicy


Nested Class Summary
static class ScribeMaintenancePolicy.DefaultScribeMaintenancePolicy
           
 
Method Summary
 void doMaintenance(MaintainableScribe scribe)
          Called periodically.
 RawScribeContent implicitSubscribe(java.util.List<Topic> topics)
          Called when subscribing for maintenance or tree rearrangement (such as parent death).
 void nodeFaulty(MaintainableScribe scribe, NodeHandle node, java.util.List<Topic> nodeWasParent, java.util.List<Topic> nodeWasChild)
          When anyone in any Topic (child or parent) is detected faulty.
 void noLongerRoot(MaintainableScribe scribe, java.util.List<Topic> topics)
          Called when membership changes "near" the local node, in overlay space.
 void subscribeFailed(MaintainableScribe scribe, java.util.List<Topic> failedTopics)
          The subscription failed.
 

Method Detail

doMaintenance

void doMaintenance(MaintainableScribe scribe)
Called periodically. Can be specified in millis by by the parameter: p2p_scribe_maintenance_interval (default 180000) // 3 minutes


noLongerRoot

void noLongerRoot(MaintainableScribe scribe,
                  java.util.List<Topic> topics)
Called when membership changes "near" the local node, in overlay space. The typical use of this function would be to detect if the root has changed and subscribe to the new root, like this:
 for (Topic topic : topics) {
   scribe.subscribe(topic);
 }
 
Note however that this approach can cause a long tail at the head of the tree.

Parameters:
handle -
membership -

nodeFaulty

void nodeFaulty(MaintainableScribe scribe,
                NodeHandle node,
                java.util.List<Topic> nodeWasParent,
                java.util.List<Topic> nodeWasChild)
When anyone in any Topic (child or parent) is detected faulty.
 for (Topic topic : nodeWasParent) {
   if (!isRoot(topic)) {
     scribe.subscribe(topic);
   }
 }
 


subscribeFailed

void subscribeFailed(MaintainableScribe scribe,
                     java.util.List<Topic> failedTopics)
The subscription failed. This is called if no particular client requested the Subscription. TODO: Does this belong in the normal policy instead?

Parameters:
failedTopics -

implicitSubscribe

RawScribeContent implicitSubscribe(java.util.List<Topic> topics)
Called when subscribing for maintenance or tree rearrangement (such as parent death). This gives the MaintenancePolicy a chance to set the ScribeContent in these messages. To convert a ScribeContent (java serialized) to a RawScribeContent use new JavaSerializedScribeContent(content)

Parameters:
topics - the topics we are implicitly subscribing to
Returns:
the ScribeContent to put into the SubscribeMessage (null is ok)

Rice Pastry API

Copyright © 2001-2005 - Rice Pastry.


Imprint-Dataprotection