| 
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--ostore.replica.Replica
Stores the Heartbeats, etc. used by the
 ReplicaStage to handle client requests for a replica.
 
 A Replica stores the top block of as many versions of a
 replica as possible.  Normally it will at least have the top block for
 all versions that have not yet been archived and the most recent one
 which has been archived.  Those versions are sufficient to fully
 traverse the version history.
 
 The release_blocks method uses the clock algorithm to
 remove versions that have not been referenced recently.  Versions are
 considered "referenced" when they are first inserted and also when they
 are returned through either the block_vid or
 missing_block_id. 
 
This class will eventually also track the degree to which entire versions are stored.
| Field Summary | |
|---|---|
static int | 
DISCONNECTED
The value for dtree_status when this node is not
 connected to the dissemination tree. | 
static int | 
INVALIDATES_ONLY
The value for dtree_status when this node is only
 partially connected to the dissemination tree.   | 
static int | 
RECEIVING_UPDATES
The value for dtree_status when this node is fully
 connected to the dissemination tree, receiving all updates from the
 inner ring. | 
| Constructor Summary | |
|---|---|
Replica(SecureHash aguid)
Constructs a new Replica. | 
|
| Method Summary | |
|---|---|
 void | 
add_hb(SignedQS signed_hb)
Updates the set of Heartbeats.   | 
 void | 
add_tentative_hb(Heartbeat hb)
Updates the most recent Heartbeat.   | 
 void | 
add_top_block(CacheableIdentity id,
              CacheablePinned handle)
Store a possibly-new version of this replica.  | 
 VID | 
block_vid(int index)
Return a name for the specified version.  | 
 int | 
get_dtree_status()
Returns the current level for dissemination tree connectivity.  | 
 Heartbeat | 
get_hb()
Returns the most recent Heartbeat for this
 Replica. | 
 boolean | 
get_local_flag()
Returns the current value of the local_only flag. | 
 Metadata | 
get_metadata(VID version)
Returns the Metadata object for the specified version,
 or null for unknown versions. | 
 boolean | 
get_open_flag()
Returns the current value of the open_locally flag. | 
 boolean | 
get_primary_flag()
Returns the current value of the is_primary flag. | 
 SignedQS | 
get_signed_guid_hb()
Returns the most recent signed Heartbeat
 received for this Replica that contains a valid
 Heartbeat.vguid field. | 
 SignedQS | 
get_signed_hb()
Returns the most recent signed Heartbeat
 received for this Replica. | 
 boolean | 
is_gap(int index)
Tests whether this Replica's history chain is missing a
 version.
  | 
 CacheableIdentity | 
missing_block_id(int index)
Return a cache name for the specified missing version.  | 
 CacheablePinned[] | 
release_all_blocks()
Surrenders all cache state.  | 
 CacheablePinned[] | 
release_blocks(int num_to_leave)
Surrenders cache state.  | 
 int | 
search_versions(Date expiration_date,
                Date creation_date,
                Long seq_num)
Searches a replica's version history.  | 
 int | 
set_dtree_status(int level)
Sets the current level for dissemination tree connectivity.  | 
 boolean | 
set_local_flag(boolean local)
Sets the local_only flag. | 
 boolean | 
set_open_flag(boolean open)
Sets the open_locally flag.
  | 
 boolean | 
set_primary_flag(boolean primary)
Sets the is_primary flag. | 
 int | 
size()
Returns the number of versions currently stored in the history chain.  | 
| Methods inherited from class java.lang.Object | 
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Field Detail | 
public static final int RECEIVING_UPDATES
dtree_status when this node is fully
 connected to the dissemination tree, receiving all updates from the
 inner ring.
public static final int INVALIDATES_ONLY
dtree_status when this node is only
 partially connected to the dissemination tree.  It receives
 heartbeats from the inner ring, which invalidate stale versions on
 this node.  Updates, which require more bandwidth, are not sent.
public static final int DISCONNECTED
dtree_status when this node is not
 connected to the dissemination tree.
| Constructor Detail | 
public Replica(SecureHash aguid)
Replica.
| Method Detail | 
public boolean set_open_flag(boolean open)
open_locally flag.
 
 This flag should be true iff the local
 ClientStage wants this Replica open.  If
 false, we can discard the Replica at will.
open - the new value.
public boolean get_open_flag()
open_locally flag.
set_open_flag(boolean)public boolean set_local_flag(boolean local)
local_only flag.
local - the new value.
public boolean get_local_flag()
local_only flag.
set_local_flag(boolean)public int set_dtree_status(int level)
level - One of RECEIVING_UPDATES,
 INVALIDATES_ONLY, or DISCONNECTED.
- Returns:
 - the previous value.
 public int get_dtree_status()
set_dtree_status(int)public Heartbeat get_hb()
Heartbeat for this
 Replica.
public SignedQS get_signed_hb()
Heartbeat
 received for this Replica.
public SignedQS get_signed_guid_hb()
Heartbeat
 received for this Replica that contains a valid
 Heartbeat.vguid field.
public boolean set_primary_flag(boolean primary)
is_primary flag.
primary - the new value.
public boolean get_primary_flag()
is_primary flag.
set_primary_flag(boolean)public void add_tentative_hb(Heartbeat hb)
Heartbeat.  If this
 Heartbeat is not more recent/relevant than the current
 one, it will be dropped.
public void add_hb(SignedQS signed_hb)
Heartbeats.  If this
 Heartbeat is not more recent/relevant than the current
 ones, it will be dropped.
public void add_top_block(CacheableIdentity id,
                          CacheablePinned handle)
id - The name of the top block of the versionhandle - A pinned handle for the block in the cache.
public int search_versions(Date expiration_date,
                           Date creation_date,
                           Long seq_num)
This method returns the index of the version with the specified expiration date, creation date or sequence number. If that version does not exist in the chain, the method returns a negative number code.
 Only one of expiration_date, creatin_date, or
 seq_num should be non-null.
expiration_date - The expiration date to find, or
 				null.creation_date - The creation date to find, or
                                null.seq_num - The sequence number to find, or null
(-1 * best - 1), where best is the index
 which the version would have if it were added.Collections.binarySearch(java.util.List, java.lang.Object)public boolean is_gap(int index)
Replica's history chain is missing a
 version.
 
 This method returns true either if one or more versions
 were created between the specified version and its predecessor
 (later version) in the chain, or if the specified index is out of
 range (not present in this Replica).
 
 Versions are considered consecutive if the last_vhash
 field of the later version correctly names the earlier version.
 
 If index == 0, this method tests whether the latest
 Heartbeat still points to the most recent version in
 the history chain.
index - An index into the version history chainpublic VID block_vid(int index)
index - An index into the version history chain.public CacheableIdentity missing_block_id(int index)
 If the missing version appears to be older than a version with
 sequence number "0", this method returns null.
index - An index into the version history chain.public Metadata get_metadata(VID version)
Metadata object for the specified version,
 or null for unknown versions.
public int size()
public CacheablePinned[] release_all_blocks()
Replica's pinned handles.public CacheablePinned[] release_blocks(int num_to_leave)
num_to_leave - The number of historical versions to save.
  | 
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||