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.


Constructor Summary
MasterImpl(org.neo4j.graphdb.GraphDatabaseService db)
           
 
Method Summary
 Response<LockResult> acquireGraphReadLock(SlaveContext context)
           
 Response<LockResult> acquireGraphWriteLock(SlaveContext context)
           
 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(org.neo4j.kernel.IdType idType)
           
 Response<Long> commitSingleResourceTransaction(SlaveContext context, String resource, TxExtractor txGetter)
           
 Response<Void> copyStore(SlaveContext context, StoreWriter writer)
           
 Response<Integer> createRelationshipType(SlaveContext context, String name)
           
 Response<Void> finishTransaction(SlaveContext context, boolean success)
           
 org.neo4j.graphdb.GraphDatabaseService getGraphDb()
           
 Response<org.neo4j.helpers.Pair<Integer,Long>> getMasterIdForCommittedTx(long txId, org.neo4j.kernel.impl.nioneo.store.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
 

Constructor Detail

MasterImpl

public MasterImpl(org.neo4j.graphdb.GraphDatabaseService db)
Method Detail

getGraphDb

public org.neo4j.graphdb.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

acquireGraphReadLock

public Response<LockResult> acquireGraphReadLock(SlaveContext context)
Specified by:
acquireGraphReadLock in interface Master

acquireGraphWriteLock

public Response<LockResult> acquireGraphWriteLock(SlaveContext context)
Specified by:
acquireGraphWriteLock in interface Master

allocateIds

public Response<IdAllocation> allocateIds(org.neo4j.kernel.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<org.neo4j.helpers.Pair<Integer,Long>> getMasterIdForCommittedTx(long txId,
                                                                                org.neo4j.kernel.impl.nioneo.store.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

shutdown

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

getOngoingTransactions

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


Copyright © 2011 The Neo4j Graph Database Project. All Rights Reserved.