com.bigdata.btree
Class PO

java.lang.Object
  extended by com.bigdata.btree.PO
All Implemented Interfaces:
IDirty, IIdentityAccess
Direct Known Subclasses:
AbstractNode

public abstract class PO
extends Object
implements IIdentityAccess, IDirty

A persistent object.

Version:
$Id: PO.java 5936 2012-02-01 16:26:33Z thompsonbry $
Author:
Bryan Thompson

Field Summary
protected  boolean deleted
          True iff the object is deleted.
protected  boolean dirty
          New objects are considered to be dirty.
protected  long identity
          The persistent identity (defined when the object is actually persisted).
 
Fields inherited from interface com.bigdata.btree.IIdentityAccess
NULL
 
Constructor Summary
PO()
           
 
Method Summary
 long getIdentity()
          The persistent identity.
protected static String indent(int height)
          Returns a string that may be used to indent a dump of the nodes in the tree.
 boolean isDeleted()
          True iff an object has been logically deleted.
 boolean isDirty()
           
 boolean isPersistent()
          True iff the object is persistent.
 void setDirty(boolean dirty)
           
 void setIdentity(long key)
          Used by the store to set the persistent identity.
 String toShortString()
          Returns a short representation of the class, identity (if assigned), the object instance, and whether or not the PO is deleted.
 String toString()
          Extends the basic behavior to display the persistent identity of the object iff the object is persistent and to mark objects that have been deleted.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.bigdata.btree.IIdentityAccess
delete
 

Field Detail

identity

protected transient long identity
The persistent identity (defined when the object is actually persisted).


deleted

protected transient boolean deleted
True iff the object is deleted.


dirty

protected transient boolean dirty
New objects are considered to be dirty. When an object is deserialized from the store the dirty flag MUST be explicitly cleared.

Constructor Detail

PO

public PO()
Method Detail

isPersistent

public final boolean isPersistent()
Description copied from interface: IIdentityAccess
True iff the object is persistent.

Specified by:
isPersistent in interface IIdentityAccess
TODO:
Historically, a mutable node was always non-persistent. With the introduction of coding of nodes and leaves for transient B+Trees on eviction from the write retention queue, those nodes and leaves become read-only when they are coded without becoming persistent. While IAbstractNodeData.isCoded() currently reflects the same distinction as IAbstractNodeData.isReadOnly(), that might not always be the case. For example, it is possible to have mutable coded node/leaf impls.

There are a number of asserts for this which are violated by the change to support coding of nodes and leaves for the transient B+Tree. Often, those asserts need to test IAbstractNodeData.isReadOnly() instead, since that reflects the concern that the node/leaf is not mutable.


isDeleted

public final boolean isDeleted()
Description copied from interface: IIdentityAccess
True iff an object has been logically deleted.

Specified by:
isDeleted in interface IIdentityAccess

getIdentity

public final long getIdentity()
                       throws IllegalStateException
Description copied from interface: IIdentityAccess
The persistent identity.

Specified by:
getIdentity in interface IIdentityAccess
Throws:
IllegalStateException - if the object is not persistent.

setIdentity

public void setIdentity(long key)
                 throws IllegalStateException
Used by the store to set the persistent identity. Note: This method should not be public.

Parameters:
identity - The identity.
Throws:
IllegalStateException - If the identity is already defined.

isDirty

public final boolean isDirty()
Specified by:
isDirty in interface IDirty

setDirty

public final void setDirty(boolean dirty)
Specified by:
setDirty in interface IDirty

toString

public String toString()
Extends the basic behavior to display the persistent identity of the object iff the object is persistent and to mark objects that have been deleted.

Overrides:
toString in class Object

toShortString

public String toShortString()
Returns a short representation of the class, identity (if assigned), the object instance, and whether or not the PO is deleted.


indent

protected static String indent(int height)
Returns a string that may be used to indent a dump of the nodes in the tree.

Parameters:
height - The height.
Returns:
A string suitable for indent at that height.


Copyright © 2006-2012 SYSTAP, LLC. All Rights Reserved.