|
P-Grid v2.0a2 API Specification | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface P2P
Defines the operations the peer-to-peer layer supports. These include initialization and shutdown requests as well as several ways to use the distributed indexing structure to locate peers and message them.
| Method Summary | |
|---|---|
void |
addP2PListener(P2PListener listener)
Register an object to be notified of new messages. |
Peer |
getLocalPeer()
Get information on the local peer. |
Peer[] |
getNeighbors()
Get information on the neighbors known to this peer. |
void |
init(Properties properties)
Initializes the P2P facility with the given properties. |
boolean |
isLocalPeerResponsible(Key key)
Checks if the local peer is responsible for the given key. |
void |
join(Peer peer)
Initialize the local routing table after connecting to network. |
void |
leave()
Prepare for shutdown by announcing departure from network. |
Peer |
lookup(Key key,
long timeout)
Get information on a peer. |
void |
removeP2PListener(P2PListener listener)
Remove registration of a current listener of new messages. |
void |
route(Key[] keys,
Message[] message)
Send a message to peers based on several keys. |
void |
route(Key key,
Message message)
Send a message to a peer. |
void |
route(KeyRange range,
Message message)
Send a message to a set of peers responsible for a range of keys. |
void |
routeToReplicas(Message message)
Send a message to peers responsible for the same part of the keyspace as the local node. |
void |
send(Peer peer,
Message message)
Send a message directly to a peer (no routing is done) |
void |
shutdown()
Shutdown the P2P. |
| Method Detail |
|---|
void addP2PListener(P2PListener listener)
listener - the P2PListener implementation to registerPeer getLocalPeer()
Peer[] getNeighbors()
void init(Properties properties)
properties - further initialization properties.boolean isLocalPeerResponsible(Key key)
key - the key to check.
true if the local peer is responsible, false otherwise.void join(Peer peer)
peer - a bootstrap peer to contactvoid leave()
void shutdown()
Peer lookup(Key key,
long timeout)
key - a key that the distant peer is responsible fortimeout - for the reply to arrive
void removeP2PListener(P2PListener listener)
listener - the P2PListener implementation to unregister
void route(Key key,
Message message)
key - a key that the distant peer is reponsible formessage - the message to send
void route(Key[] keys,
Message[] message)
keys - an array of destination keysmessage - the message to send
void route(KeyRange range,
Message message)
range - the range of keysmessage - the message to sendvoid routeToReplicas(Message message)
message - the message to send
void send(Peer peer,
Message message)
peer - the peermessage - the message to send
|
P-Grid v2.0a2 API Specification | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||