ozone core API

org.ozoneDB.core.classicStore
Class Cluster

java.lang.Object
  |
  +--org.ozoneDB.core.classicStore.Cluster

public class Cluster
extends java.lang.Object


Nested Class Summary
(package private)  class Cluster.Chunk
           
 
Field Summary
(package private)  ClusterID cid
           
static byte CL_HEADER_CHUNK
           
(package private)  ClassicStore classicStore
           
static java.lang.String CLUSTER_FILE_SUFF
           
(package private)  long clusterSize
           
static int DATA
           
static byte DATA_CHUNK
           
static byte DATA_HEADER_CHUNK
           
static byte DATA_OID_CHUNK
           
(package private)  Env env
           
static java.lang.String LEAK_FILE_SUFF
           
static double LEAK_WEIGHT
           
static byte LEAKS
           
(package private)  long leakSize
           
static int MAX_SIZE
           
static byte NONE
           
(package private)  DxCollection objects
           
static byte OBJECTS
           
static java.lang.String RECOVERY_SUFF
           
(package private)  byte recoveryMode
           
static int STATE
           
(package private)  java.io.DataOutputStream stream
           
static int TRANS
           
static int VERSION
           
 
Constructor Summary
Cluster(Env _env, ClassicStore _classicStore)
           
Cluster(Env _env, ClassicStore _classicStore, ClusterID _cid)
           
 
Method Summary
 void appendObject(DeathObject dobj, TransactionID tid, boolean serialize, boolean useClone)
           
 void beginRecovery(byte mode)
           
 void close()
           
 ClusterID cluID()
           
 void endRecovery(byte mode)
           
private  long entrySize(DeathObject dobj)
          size of a object entry: ObjectID : 8 bytes TransactionID : 8 bytes streamed ObjectContainer: comes from DeathObject.stateSize ChunkID : 1 byte data length : 4 bytes data itself : n bytes -> data overhead : 21 bytes + object state
 java.io.File fileHandle()
           
protected  void finalize()
           
 java.io.File leakFileHandle()
           
 long leakSize()
           
protected  boolean needsCompressing()
          Checks, if the specified cluster needs to be compressed.
 DxCollection objects()
           
 void open()
           
private  Cluster.Chunk readChunk(java.io.DataInputStream in, boolean skip)
           
 DxCollection readLeaks(TransactionID rollBackTid, boolean ordered)
           
 boolean readObjects(int whatToRead, TransactionID rollBackTid)
          reads all objects from the cluster, while dropping leaks in normal mode or broken-transaction-objects in recovery mode; returns false if any objects were dropped
 void removeFromDisk()
           
 void rollBack(TransactionID rollBackTid)
           
 void rollBackLeaks(TransactionID rollBackTid)
           
 long size()
          The cluster size has to different meanings: - while writing it means the size of the cluster file, so that we can limit the file's size as good as possible to the user defined maximum cluster size - while reading it means the sum of the sizes of all its death objects, so that we can determine exactly the space we will need in the object buffer of the cluster space
private  void writeChunk(java.io.DataOutputStream out, Cluster.Chunk chunk)
           
 void writeHeader()
           
 void writeLeak(DeathObject dobj, TransactionID tid)
           
 void writeLeak(ObjectID oid, TransactionID tid, long objSize)
           
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VERSION

public static final int VERSION
See Also:
Constant Field Values

MAX_SIZE

public static int MAX_SIZE

CLUSTER_FILE_SUFF

public static final java.lang.String CLUSTER_FILE_SUFF
See Also:
Constant Field Values

LEAK_FILE_SUFF

public static final java.lang.String LEAK_FILE_SUFF
See Also:
Constant Field Values

RECOVERY_SUFF

public static final java.lang.String RECOVERY_SUFF
See Also:
Constant Field Values

LEAK_WEIGHT

public static final double LEAK_WEIGHT
See Also:
Constant Field Values

DATA

public static final int DATA
See Also:
Constant Field Values

STATE

public static final int STATE
See Also:
Constant Field Values

TRANS

public static final int TRANS
See Also:
Constant Field Values

CL_HEADER_CHUNK

public static final byte CL_HEADER_CHUNK
See Also:
Constant Field Values

DATA_OID_CHUNK

public static final byte DATA_OID_CHUNK
See Also:
Constant Field Values

DATA_HEADER_CHUNK

public static final byte DATA_HEADER_CHUNK
See Also:
Constant Field Values

DATA_CHUNK

public static final byte DATA_CHUNK
See Also:
Constant Field Values

NONE

public static final byte NONE
See Also:
Constant Field Values

OBJECTS

public static final byte OBJECTS
See Also:
Constant Field Values

LEAKS

public static final byte LEAKS
See Also:
Constant Field Values

cid

ClusterID cid

recoveryMode

byte recoveryMode

clusterSize

long clusterSize

leakSize

long leakSize

stream

java.io.DataOutputStream stream

objects

DxCollection objects

env

Env env

classicStore

ClassicStore classicStore
Constructor Detail

Cluster

public Cluster(Env _env,
               ClassicStore _classicStore)

Cluster

public Cluster(Env _env,
               ClassicStore _classicStore,
               ClusterID _cid)
Method Detail

finalize

protected void finalize()
                 throws java.lang.Throwable
Overrides:
finalize in class java.lang.Object
java.lang.Throwable

cluID

public final ClusterID cluID()

objects

public final DxCollection objects()

beginRecovery

public final void beginRecovery(byte mode)

endRecovery

public final void endRecovery(byte mode)

fileHandle

public final java.io.File fileHandle()

leakFileHandle

public final java.io.File leakFileHandle()

size

public final long size()
The cluster size has to different meanings: - while writing it means the size of the cluster file, so that we can limit the file's size as good as possible to the user defined maximum cluster size - while reading it means the sum of the sizes of all its death objects, so that we can determine exactly the space we will need in the object buffer of the cluster space


open

public void open()
          throws java.io.IOException
java.io.IOException

close

public void close()
           throws java.io.IOException
java.io.IOException

writeHeader

public void writeHeader()
                 throws java.io.IOException
java.io.IOException

entrySize

private final long entrySize(DeathObject dobj)
size of a object entry: ObjectID : 8 bytes TransactionID : 8 bytes streamed ObjectContainer: comes from DeathObject.stateSize ChunkID : 1 byte data length : 4 bytes data itself : n bytes -> data overhead : 21 bytes + object state


appendObject

public void appendObject(DeathObject dobj,
                         TransactionID tid,
                         boolean serialize,
                         boolean useClone)
                  throws java.lang.Exception
java.lang.Exception

readObjects

public boolean readObjects(int whatToRead,
                           TransactionID rollBackTid)
                    throws java.lang.Exception
reads all objects from the cluster, while dropping leaks in normal mode or broken-transaction-objects in recovery mode; returns false if any objects were dropped

java.lang.Exception

leakSize

public long leakSize()

writeLeak

public void writeLeak(DeathObject dobj,
                      TransactionID tid)
               throws java.lang.Exception
java.lang.Exception

writeLeak

public void writeLeak(ObjectID oid,
                      TransactionID tid,
                      long objSize)
               throws java.lang.Exception
java.lang.Exception

readLeaks

public DxCollection readLeaks(TransactionID rollBackTid,
                              boolean ordered)
                       throws java.lang.Exception
java.lang.Exception

removeFromDisk

public void removeFromDisk()
                    throws java.io.IOException
java.io.IOException

writeChunk

private void writeChunk(java.io.DataOutputStream out,
                        Cluster.Chunk chunk)
                 throws java.io.IOException
java.io.IOException

readChunk

private Cluster.Chunk readChunk(java.io.DataInputStream in,
                                boolean skip)
                         throws java.io.IOException
java.io.IOException

rollBack

public void rollBack(TransactionID rollBackTid)
              throws java.lang.Exception
java.lang.Exception

rollBackLeaks

public void rollBackLeaks(TransactionID rollBackTid)
                   throws java.lang.Exception
java.lang.Exception

needsCompressing

protected boolean needsCompressing()
Checks, if the specified cluster needs to be compressed.


ozone core API

Copyright (C) The Ozone Database Project - www.ozone-db.org. All rights reserved.