org.neo4j.kernel.ha
Class MasterImpl

java.lang.Object
  extended by org.neo4j.kernel.ha.MasterImpl
All Implemented Interfaces:
Master

public class MasterImpl
extends Object
implements Master

This is the real master code that executes on a master. The actual communication over network happens in MasterClient and MasterServer.


Field Summary
static int UNFINISHED_TRANSACTION_CLEANUP_DELAY
           
 
Constructor Summary
MasterImpl(GraphDatabaseService db, Map<String,String> config)
           
 
Method Summary
 Response<LockResult> acquireIndexReadLock(SlaveContext context, String index, String key)
           
 Response<LockResult> acquireIndexWriteLock(SlaveContext context, String index, String key)
           
 Response<LockResult> acquireNodeReadLock(SlaveContext context, long... nodes)
           
 Response<LockResult> acquireNodeWriteLock(SlaveContext context, long... nodes)
           
 Response<LockResult> acquireRelationshipReadLock(SlaveContext context, long... relationships)
           
 Response<LockResult> acquireRelationshipWriteLock(SlaveContext context, long... relationships)
           
 Response<IdAllocation> allocateIds(IdType idType)
           
 Response<Long> commitSingleResourceTransaction(SlaveContext context, String resource, TxExtractor txGetter)
           
 Response<Void> copyStore(SlaveContext context, StoreWriter writer)
           
 Response<Void> copyTransactions(SlaveContext context, String dsName, long startTxId, long endTxId)
           
 Response<Integer> createRelationshipType(SlaveContext context, String name)
           
 Response<Void> finishTransaction(SlaveContext context, boolean success)
           
 GraphDatabaseService getGraphDb()
           
 Response<Pair<Integer,Long>> getMasterIdForCommittedTx(long txId, StoreId storeId)
          Gets the master id for a given txId, also a checksum for that tx.
 Map<Integer,Collection<SlaveContext>> getOngoingTransactions()
           
 Response<Void> initializeTx(SlaveContext context)
          Called when the first write operation of lock is performed for a transaction.
 Response<Void> pullUpdates(SlaveContext context)
           
 void shutdown()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UNFINISHED_TRANSACTION_CLEANUP_DELAY

public static final int UNFINISHED_TRANSACTION_CLEANUP_DELAY
See Also:
Constant Field Values
Constructor Detail

MasterImpl

public MasterImpl(GraphDatabaseService db,
                  Map<String,String> config)
Method Detail

getGraphDb

public GraphDatabaseService getGraphDb()

initializeTx

public Response<Void> initializeTx(SlaveContext context)
Description copied from interface: Master
Called when the first write operation of lock is performed for a transaction.

Specified by:
initializeTx in interface Master

acquireNodeReadLock

public Response<LockResult> acquireNodeReadLock(SlaveContext context,
                                                long... nodes)
Specified by:
acquireNodeReadLock in interface Master

acquireNodeWriteLock

public Response<LockResult> acquireNodeWriteLock(SlaveContext context,
                                                 long... nodes)
Specified by:
acquireNodeWriteLock in interface Master

acquireRelationshipReadLock

public Response<LockResult> acquireRelationshipReadLock(SlaveContext context,
                                                        long... relationships)
Specified by:
acquireRelationshipReadLock in interface Master

acquireRelationshipWriteLock

public Response<LockResult> acquireRelationshipWriteLock(SlaveContext context,
                                                         long... relationships)
Specified by:
acquireRelationshipWriteLock in interface Master

allocateIds

public Response<IdAllocation> allocateIds(IdType idType)
Specified by:
allocateIds in interface Master

commitSingleResourceTransaction

public Response<Long> commitSingleResourceTransaction(SlaveContext context,
                                                      String resource,
                                                      TxExtractor txGetter)
Specified by:
commitSingleResourceTransaction in interface Master

finishTransaction

public Response<Void> finishTransaction(SlaveContext context,
                                        boolean success)
Specified by:
finishTransaction in interface Master

createRelationshipType

public Response<Integer> createRelationshipType(SlaveContext context,
                                                String name)
Specified by:
createRelationshipType in interface Master

pullUpdates

public Response<Void> pullUpdates(SlaveContext context)
Specified by:
pullUpdates in interface Master

getMasterIdForCommittedTx

public Response<Pair<Integer,Long>> getMasterIdForCommittedTx(long txId,
                                                              StoreId storeId)
Description copied from interface: Master
Gets the master id for a given txId, also a checksum for that tx.

Specified by:
getMasterIdForCommittedTx in interface Master
Parameters:
txId - the transaction id to get the data for.
storeId - clients store id.
Returns:
the master id for a given txId, also a checksum for that tx.

copyStore

public Response<Void> copyStore(SlaveContext context,
                                StoreWriter writer)
Specified by:
copyStore in interface Master

copyTransactions

public Response<Void> copyTransactions(SlaveContext context,
                                       String dsName,
                                       long startTxId,
                                       long endTxId)
Specified by:
copyTransactions in interface Master

shutdown

public void shutdown()
Specified by:
shutdown in interface Master

acquireIndexReadLock

public Response<LockResult> acquireIndexReadLock(SlaveContext context,
                                                 String index,
                                                 String key)
Specified by:
acquireIndexReadLock in interface Master

acquireIndexWriteLock

public Response<LockResult> acquireIndexWriteLock(SlaveContext context,
                                                  String index,
                                                  String key)
Specified by:
acquireIndexWriteLock in interface Master

getOngoingTransactions

public Map<Integer,Collection<SlaveContext>> getOngoingTransactions()


Copyright © 2002-2012 The Neo4j Graph Database Project. All Rights Reserved.