bamboo.dmgr
Class DataManager

java.lang.Object
  extended by bamboo.util.StandardStage
      extended by bamboo.dmgr.DataManager
All Implemented Interfaces:
EventHandlerIF, SingleThreadedEventHandlerIF

public class DataManager
extends StandardStage
implements SingleThreadedEventHandlerIF

Manages the data stored on Bamboo nodes.

Version:
$Id: DataManager.java,v 1.63 2004/11/16 04:58:04 srhea Exp $
Author:
Sean C. Rhea

Nested Class Summary
protected static class DataManager.AntiEntropyAlarm
           
protected static class DataManager.AntiEntropyState
           
protected static class DataManager.DiscardAlarm
           
protected static class DataManager.DiscardState
           
protected static class DataManager.GuidRange
           
protected static class DataManager.PutOrRemoveState
           
protected static interface DataManager.TreeReadyCB
          If a piece of code needs the Merkle tree stored by a TreeState object to be valid from the root down, it calls TreeState.wait_for_ready with a callback of this type; when the tree is valid, the TreeState object will call all of the registered callbacks.
protected  class DataManager.TreeState
           
 
Field Summary
protected  int ae_period
           
protected  DataManager.AntiEntropyState ae_state
           
protected static long app_id
           
protected  ASyncCore.TimerCB check_put_or_remove_acks
           
protected  DataManager.DiscardState ds
           
protected  int expansion
           
protected  boolean initialized
           
protected  boolean iterative_routing
          Whether or not we do iterative routing for ReplicaSetReq messages.
protected  BigInteger MAX_GUID
           
protected  MessageDigest md
           
protected  Map merkle_trees
           
protected static BigInteger MIN_GUID
           
protected  BigInteger MODULUS
           
protected  BigInteger my_guid
           
protected  BambooNeighborInfo my_neighbor_info
           
protected static BigInteger NEG_ONE
           
protected  long next_fetch_keys_seq
           
protected  long next_fetch_seq
           
protected  long next_put_or_remove_seq
           
protected  BambooNeighborInfo[] preds
           
protected  long put_give_up_time
           
protected  Map put_or_remove_acks
           
protected  long put_retry_time
           
protected  Random rand
           
protected  int required_acks
           
protected  BigInteger resp_high
          We are responsible for storing pointers in the ranges [resp_low, my_guid] and [my_guid, resp_high]
protected  BigInteger resp_low
          We are responsible for storing pointers in the ranges [resp_low, my_guid] and [my_guid, resp_high]
protected  BambooNeighborInfo[] succs
           
protected  LinkedList wait_q
           
 
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
DataManager()
           
 
Method Summary
protected  SortedSet calc_shared_dbs(BambooNeighborInfo other)
           
protected  void check_put_or_remove_done(Long seq, DataManager.PutOrRemoveState p)
           
protected  void choose_db(BambooNeighborInfo other)
           
protected  void db_put(long time_usec, int ttl_sec, BigInteger guid, ByteBuffer value, boolean put, InetAddress client_id, byte[] hash, Object user_data)
           
protected  void goto_next_node_ready(MerkleTree tree)
           
protected  void goto_next_node()
           
protected  void handle_ae_alarm(DataManager.AntiEntropyAlarm alarm)
           
protected  void handle_ae_tree_ready_resp(MerkleTree tree, FetchMerkleTreeNodeResp resp)
           
protected  void handle_ae_tree_ready(MerkleTree tree)
           
protected  void handle_app_reg_resp(BambooRouterAppRegResp resp)
           
protected  void handle_discard_alarm(DataManager.DiscardAlarm item)
           
protected  void handle_discard_get_resp(StorageManager.GetByGuidResp resp)
           
protected  void handle_fetch_data_req_have_data(StorageManager.GetByKeyResp resp)
           
protected  void handle_fetch_data_req(FetchDataReq req)
           
protected  void handle_fetch_data_resp(FetchDataResp resp)
           
protected  void handle_fetch_keys_check(StorageManager.GetByKeyResp resp)
           
protected  void handle_fetch_keys_get_resp(StorageManager.GetByTimeResp resp)
           
protected  void handle_fetch_keys_req(FetchKeysReq req)
           
protected  void handle_fetch_keys_resp(FetchKeysResp resp)
           
protected  void handle_fetch_merkle_tree_node_reject(FetchMerkleTreeNodeReject reject)
           
protected  void handle_fetch_merkle_tree_node_req(FetchMerkleTreeNodeReq req)
           
protected  void handle_fetch_merkle_tree_node_resp(FetchMerkleTreeNodeResp resp)
           
protected  void handle_fetch_tree_ready(MerkleTree tree, FetchMerkleTreeNodeReq req)
           
protected  void handle_get_by_key_resp(StorageManager.GetByKeyResp resp)
           
protected  void handle_get_by_time_resp(StorageManager.GetByTimeResp resp)
           
protected  void handle_leaf_set_changed(BambooLeafSetChanged msg)
           
protected  void handle_pub_to_leaf_set_ack(PutOrRemoveAck msg)
           
protected  void handle_pub_to_leaf_set(PutOrRemoveMsg msg)
           
protected  void handle_put_or_remove_req(PutOrRemoveReq e)
           
protected  void handle_put_resp(StorageManager.PutResp resp)
           
protected  void handle_replica_set_req(ReplicaSetReq req)
           
protected  void handle_replica_set_resp(ReplicaSetResp resp)
           
 void handleEvent(QueueElementIF item)
           
protected  boolean in_leaf_set_range(BigInteger q)
           
protected  boolean in_range_mod(BigInteger low, BigInteger high, BigInteger query)
           
 void init(ConfigDataIF config)
           
protected  void invalidate_merkle_trees(BigInteger guid, long time_usec)
           
protected  void next_check_put_or_remove_acks()
           
protected  BambooNeighborInfo random_ls_member()
           
protected  DataManager.TreeState tree_state(BigInteger low_guid, BigInteger high_guid)
           
protected  void update_merkle_trees(StorageManager.PutResp resp)
           
protected  boolean valid_db(ostore.util.NodeId peer, BigInteger peer_guid, BigInteger low, BigInteger high)
           
 
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

MIN_GUID

protected static final BigInteger MIN_GUID

NEG_ONE

protected static final BigInteger NEG_ONE

app_id

protected static final long app_id

MODULUS

protected BigInteger MODULUS

MAX_GUID

protected BigInteger MAX_GUID

rand

protected Random rand

my_guid

protected BigInteger my_guid

initialized

protected boolean initialized

wait_q

protected LinkedList wait_q

preds

protected BambooNeighborInfo[] preds

succs

protected BambooNeighborInfo[] succs

md

protected MessageDigest md

ae_period

protected int ae_period

required_acks

protected int required_acks

put_retry_time

protected long put_retry_time

put_give_up_time

protected long put_give_up_time

iterative_routing

protected boolean iterative_routing
Whether or not we do iterative routing for ReplicaSetReq messages.


resp_low

protected BigInteger resp_low
We are responsible for storing pointers in the ranges [resp_low, my_guid] and [my_guid, resp_high]


resp_high

protected BigInteger resp_high
We are responsible for storing pointers in the ranges [resp_low, my_guid] and [my_guid, resp_high]


put_or_remove_acks

protected Map put_or_remove_acks

next_put_or_remove_seq

protected long next_put_or_remove_seq

check_put_or_remove_acks

protected ASyncCore.TimerCB check_put_or_remove_acks

expansion

protected int expansion

merkle_trees

protected Map merkle_trees

next_fetch_seq

protected long next_fetch_seq

next_fetch_keys_seq

protected long next_fetch_keys_seq

ae_state

protected DataManager.AntiEntropyState ae_state

my_neighbor_info

protected BambooNeighborInfo my_neighbor_info

ds

protected DataManager.DiscardState ds
Constructor Detail

DataManager

public DataManager()
            throws Exception
Throws:
Exception
Method Detail

random_ls_member

protected BambooNeighborInfo random_ls_member()

init

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

handleEvent

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

handle_app_reg_resp

protected void handle_app_reg_resp(BambooRouterAppRegResp resp)

in_leaf_set_range

protected boolean in_leaf_set_range(BigInteger q)

handle_leaf_set_changed

protected void handle_leaf_set_changed(BambooLeafSetChanged msg)

in_range_mod

protected boolean in_range_mod(BigInteger low,
                               BigInteger high,
                               BigInteger query)

handle_put_or_remove_req

protected void handle_put_or_remove_req(PutOrRemoveReq e)

next_check_put_or_remove_acks

protected void next_check_put_or_remove_acks()

handle_pub_to_leaf_set

protected void handle_pub_to_leaf_set(PutOrRemoveMsg msg)

update_merkle_trees

protected void update_merkle_trees(StorageManager.PutResp resp)

handle_put_resp

protected void handle_put_resp(StorageManager.PutResp resp)

handle_pub_to_leaf_set_ack

protected void handle_pub_to_leaf_set_ack(PutOrRemoveAck msg)

check_put_or_remove_done

protected void check_put_or_remove_done(Long seq,
                                        DataManager.PutOrRemoveState p)

db_put

protected void db_put(long time_usec,
                      int ttl_sec,
                      BigInteger guid,
                      ByteBuffer value,
                      boolean put,
                      InetAddress client_id,
                      byte[] hash,
                      Object user_data)

calc_shared_dbs

protected SortedSet calc_shared_dbs(BambooNeighborInfo other)

handle_get_by_time_resp

protected void handle_get_by_time_resp(StorageManager.GetByTimeResp resp)

tree_state

protected DataManager.TreeState tree_state(BigInteger low_guid,
                                           BigInteger high_guid)

invalidate_merkle_trees

protected void invalidate_merkle_trees(BigInteger guid,
                                       long time_usec)

choose_db

protected void choose_db(BambooNeighborInfo other)

handle_ae_alarm

protected void handle_ae_alarm(DataManager.AntiEntropyAlarm alarm)

handle_ae_tree_ready

protected void handle_ae_tree_ready(MerkleTree tree)

handle_fetch_merkle_tree_node_resp

protected void handle_fetch_merkle_tree_node_resp(FetchMerkleTreeNodeResp resp)

handle_ae_tree_ready_resp

protected void handle_ae_tree_ready_resp(MerkleTree tree,
                                         FetchMerkleTreeNodeResp resp)

handle_fetch_merkle_tree_node_reject

protected void handle_fetch_merkle_tree_node_reject(FetchMerkleTreeNodeReject reject)

handle_fetch_keys_resp

protected void handle_fetch_keys_resp(FetchKeysResp resp)

handle_fetch_keys_check

protected void handle_fetch_keys_check(StorageManager.GetByKeyResp resp)

goto_next_node

protected void goto_next_node()

goto_next_node_ready

protected void goto_next_node_ready(MerkleTree tree)

handle_get_by_key_resp

protected void handle_get_by_key_resp(StorageManager.GetByKeyResp resp)

handle_fetch_data_resp

protected void handle_fetch_data_resp(FetchDataResp resp)

valid_db

protected boolean valid_db(ostore.util.NodeId peer,
                           BigInteger peer_guid,
                           BigInteger low,
                           BigInteger high)

handle_fetch_merkle_tree_node_req

protected void handle_fetch_merkle_tree_node_req(FetchMerkleTreeNodeReq req)

handle_fetch_tree_ready

protected void handle_fetch_tree_ready(MerkleTree tree,
                                       FetchMerkleTreeNodeReq req)

handle_fetch_keys_req

protected void handle_fetch_keys_req(FetchKeysReq req)

handle_fetch_keys_get_resp

protected void handle_fetch_keys_get_resp(StorageManager.GetByTimeResp resp)

handle_fetch_data_req

protected void handle_fetch_data_req(FetchDataReq req)

handle_fetch_data_req_have_data

protected void handle_fetch_data_req_have_data(StorageManager.GetByKeyResp resp)

handle_replica_set_req

protected void handle_replica_set_req(ReplicaSetReq req)

handle_discard_alarm

protected void handle_discard_alarm(DataManager.DiscardAlarm item)

handle_discard_get_resp

protected void handle_discard_get_resp(StorageManager.GetByGuidResp resp)

handle_replica_set_resp

protected void handle_replica_set_resp(ReplicaSetResp resp)