bamboo.openhash.redir
Class RedirClient

java.lang.Object
  extended by bamboo.util.StandardStage
      extended by bamboo.openhash.redir.RedirClient
All Implemented Interfaces:
EventHandlerIF, SingleThreadedEventHandlerIF

public class RedirClient
extends StandardStage
implements SingleThreadedEventHandlerIF

An implementation of ReDiR.

Version:
$Id: RedirClient.java,v 1.11 2004/11/19 23:20:14 srhea Exp $
Author:
Sean C. Rhea

Nested Class Summary
static interface RedirClient.JoinCb
           
static class RedirClient.JoinState
           
static interface RedirClient.LookupCb
           
static class RedirClient.LookupState
           
 
Field Summary
protected  GatewayClient client
           
protected  MessageDigest digest
           
 GatewayClient.GetDoneCb join_get_done_cb
           
 GatewayClient.PutDoneCb join_put_done_cb
           
 GatewayClient.GetDoneCb lookup_done_cb
           
protected static BigInteger MOD
           
protected  Set namespaces
           
 ASyncCore.TimerCB put_retry_cb
           
 ASyncCore.TimerCB rejoin_cb
           
protected static BigInteger TWO
           
 
Fields inherited from class bamboo.util.StandardStage
acore, classifier, DEBUG, event_types, inb_msg_types, logger, my_node_id, my_sink, outb_msg_types, sim_running
 
Constructor Summary
RedirClient()
           
 
Method Summary
static byte[] addr2bytes(InetSocketAddress addr)
           
static byte[] bi2bytes(BigInteger i)
           
static InetSocketAddress bytes2addr(byte[] bytes)
           
static BigInteger bytes2bi(byte[] bytes)
           
 void cancel_join(Object join_token)
           
 void handleEvent(QueueElementIF item)
           
 void init(ConfigDataIF config)
           
protected  void join_get(RedirClient.JoinState state)
           
protected  void join_put(RedirClient.JoinState state)
           
 Object join(InetSocketAddress addr, BigInteger key, BigInteger namespace, int levels, int ttl_s, String application, RedirClient.JoinCb cb, Object user_data)
           
protected  void lookup_get(RedirClient.LookupState state)
           
protected  void lookup_no_successor(RedirClient.LookupState state)
           
protected  void lookup_result(RedirClient.LookupState state, InetSocketAddress succ_addr, BigInteger succ_hash)
           
 void lookup(BigInteger key, BigInteger namespace, int levels, String application, RedirClient.LookupCb cb, Object user_data)
           
protected static BigInteger rendevous_point(BigInteger key, BigInteger namespace, int level)
           
 
Methods inherited from class bamboo.util.StandardStage
BUG, BUG, BUG, config_get_boolean, config_get_double, config_get_int, config_get_string, configGetInt, destroy, dispatch, enqueue, handleEvents, lookup_stage, now_ms, timer_ms
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TWO

protected static BigInteger TWO

MOD

protected static BigInteger MOD

client

protected GatewayClient client

digest

protected MessageDigest digest

namespaces

protected Set namespaces

join_get_done_cb

public GatewayClient.GetDoneCb join_get_done_cb

join_put_done_cb

public GatewayClient.PutDoneCb join_put_done_cb

put_retry_cb

public ASyncCore.TimerCB put_retry_cb

rejoin_cb

public ASyncCore.TimerCB rejoin_cb

lookup_done_cb

public GatewayClient.GetDoneCb lookup_done_cb
Constructor Detail

RedirClient

public RedirClient()
Method Detail

rendevous_point

protected static BigInteger rendevous_point(BigInteger key,
                                            BigInteger namespace,
                                            int level)

bytes2addr

public static InetSocketAddress bytes2addr(byte[] bytes)

addr2bytes

public static byte[] addr2bytes(InetSocketAddress addr)

bi2bytes

public static byte[] bi2bytes(BigInteger i)

bytes2bi

public static BigInteger bytes2bi(byte[] bytes)

init

public void init(ConfigDataIF config)
          throws Exception
Specified by:
init in interface EventHandlerIF
Overrides:
init in class StandardStage
Throws:
Exception

join

public Object join(InetSocketAddress addr,
                   BigInteger key,
                   BigInteger namespace,
                   int levels,
                   int ttl_s,
                   String application,
                   RedirClient.JoinCb cb,
                   Object user_data)

cancel_join

public void cancel_join(Object join_token)

join_get

protected void join_get(RedirClient.JoinState state)

join_put

protected void join_put(RedirClient.JoinState state)

lookup

public void lookup(BigInteger key,
                   BigInteger namespace,
                   int levels,
                   String application,
                   RedirClient.LookupCb cb,
                   Object user_data)

lookup_get

protected void lookup_get(RedirClient.LookupState state)

lookup_no_successor

protected void lookup_no_successor(RedirClient.LookupState state)

lookup_result

protected void lookup_result(RedirClient.LookupState state,
                             InetSocketAddress succ_addr,
                             BigInteger succ_hash)

handleEvent

public void handleEvent(QueueElementIF item)
Specified by:
handleEvent in interface EventHandlerIF
Overrides:
handleEvent in class StandardStage