fabric.store
Class TransactionManager

java.lang.Object
  extended by fabric.store.TransactionManager

public class TransactionManager
extends java.lang.Object


Constructor Summary
TransactionManager(ObjectDB database, java.security.PrivateKey signingKey)
           
 
Method Summary
 void abortTransaction(NodePrincipal worker, long transactionID)
          Instruct the transaction manager that the given transaction is aborting
 void commitTransaction(RemoteWorker workerNode, NodePrincipal workerPrincipal, long transactionID)
          Execute the commit phase of two phase commit.
 Glob getGlob(long onum, RemoteWorker subscriber, MessageHandlerThread handler)
          Returns a Glob containing the specified object.
 ObjectGroup getGroup(NodePrincipal principal, RemoteWorker subscriber, long onum, MessageHandlerThread handler)
          Returns an ObjectGroup containing the specified object.
 long[] newOnums(NodePrincipal worker, int num)
           
 boolean prepare(NodePrincipal worker, PrepareRequest req)
           Execute the prepare phase of two phase commit.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TransactionManager

public TransactionManager(ObjectDB database,
                          java.security.PrivateKey signingKey)
Method Detail

abortTransaction

public void abortTransaction(NodePrincipal worker,
                             long transactionID)
                      throws AccessException
Instruct the transaction manager that the given transaction is aborting

Throws:
AccessException

commitTransaction

public void commitTransaction(RemoteWorker workerNode,
                              NodePrincipal workerPrincipal,
                              long transactionID)
                       throws TransactionCommitFailedException
Execute the commit phase of two phase commit.

Throws:
TransactionCommitFailedException

prepare

public boolean prepare(NodePrincipal worker,
                       PrepareRequest req)
                throws TransactionPrepareFailedException

Execute the prepare phase of two phase commit. Validates the transaction to make sure that no conflicts would occur if this transaction were committed. Once prepare returns successfully, the corresponding transaction can only fail if the coordinator aborts it.

The prepare method must check a large number of conditions:

Parameters:
worker - The worker requesting the prepare
Returns:
whether a subtransaction was created for making Statistics objects.
Throws:
TransactionPrepareFailedException - If the transaction would cause a conflict or if the worker is insufficiently privileged to execute the transaction.

getGlob

public Glob getGlob(long onum,
                    RemoteWorker subscriber,
                    MessageHandlerThread handler)
             throws AccessException
Returns a Glob containing the specified object.

Parameters:
subscriber - If non-null, then the given worker will be subscribed to the object as a dissemination node.
handler - Used to track read statistics.
Throws:
AccessException

getGroup

public ObjectGroup getGroup(NodePrincipal principal,
                            RemoteWorker subscriber,
                            long onum,
                            MessageHandlerThread handler)
                     throws AccessException
Returns an ObjectGroup containing the specified object.

Parameters:
principal - The principal performing the read.
subscriber - If non-null, then the given worker will be subscribed to the object as a worker.
onum - The onum for an object that should be in the group.
handler - Used to track read statistics.
Throws:
AccessException

newOnums

public long[] newOnums(NodePrincipal worker,
                       int num)
                throws AccessException
Throws:
AccessException - if the principal is not allowed to create objects on this store.