org.neo4j.kernel.ha
Class MasterClient

java.lang.Object
  extended by org.neo4j.com.Client<Master>
      extended by org.neo4j.kernel.ha.MasterClient
All Implemented Interfaces:
org.jboss.netty.channel.ChannelPipelineFactory, Master

public class MasterClient
extends org.neo4j.com.Client<Master>
implements Master

The Master a slave should use to communicate with its master. It serializes requests and sends them to the master, more specifically MasterServer (which delegates to MasterImpl on the master side.


Nested Class Summary
protected static class MasterClient.AcquireLockSerializer
           
static class MasterClient.HaRequestType
           
 
Field Summary
protected static org.neo4j.com.Deserializer<LockResult> LOCK_RESULT_DESERIALIZER
           
 
Fields inherited from class org.neo4j.com.Client
DEFAULT_MAX_NUMBER_OF_CONCURRENT_REQUESTS_PER_CLIENT, DEFAULT_READ_RESPONSE_TIMEOUT_SECONDS
 
Constructor Summary
MasterClient(Machine machine, org.neo4j.graphdb.GraphDatabaseService graphDb)
           
MasterClient(String hostNameOrIp, int port, org.neo4j.graphdb.GraphDatabaseService graphDb)
           
 
Method Summary
 org.neo4j.com.Response<LockResult> acquireNodeReadLock(org.neo4j.com.SlaveContext context, long... nodes)
           
 org.neo4j.com.Response<LockResult> acquireNodeWriteLock(org.neo4j.com.SlaveContext context, long... nodes)
           
 org.neo4j.com.Response<LockResult> acquireRelationshipReadLock(org.neo4j.com.SlaveContext context, long... relationships)
           
 org.neo4j.com.Response<LockResult> acquireRelationshipWriteLock(org.neo4j.com.SlaveContext context, long... relationships)
           
 org.neo4j.com.Response<IdAllocation> allocateIds(org.neo4j.kernel.IdType idType)
           
 org.neo4j.com.Response<Long> commitSingleResourceTransaction(org.neo4j.com.SlaveContext context, String resource, org.neo4j.com.TxExtractor txGetter)
           
 org.neo4j.com.Response<Void> copyStore(org.neo4j.com.SlaveContext context, org.neo4j.com.StoreWriter writer)
           
 org.neo4j.com.Response<Integer> createRelationshipType(org.neo4j.com.SlaveContext context, String name)
           
 org.neo4j.com.Response<Void> finishTransaction(org.neo4j.com.SlaveContext context)
           
 org.neo4j.com.Response<Integer> getMasterIdForCommittedTx(long txId)
           
 org.neo4j.com.Response<Void> pullUpdates(org.neo4j.com.SlaveContext context)
           
protected static IdAllocation readIdAllocation(org.jboss.netty.buffer.ChannelBuffer buffer)
           
 void rollbackOngoingTransactions(org.neo4j.com.SlaveContext context)
           
protected  boolean shouldCheckStoreId(org.neo4j.com.RequestType<Master> type)
           
 
Methods inherited from class org.neo4j.com.Client
getPipeline, readTransactionStreamHeader, readTransactionStreams, sendRequest, shutdown, writeContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOCK_RESULT_DESERIALIZER

protected static final org.neo4j.com.Deserializer<LockResult> LOCK_RESULT_DESERIALIZER
Constructor Detail

MasterClient

public MasterClient(String hostNameOrIp,
                    int port,
                    org.neo4j.graphdb.GraphDatabaseService graphDb)

MasterClient

public MasterClient(Machine machine,
                    org.neo4j.graphdb.GraphDatabaseService graphDb)
Method Detail

shouldCheckStoreId

protected boolean shouldCheckStoreId(org.neo4j.com.RequestType<Master> type)
Overrides:
shouldCheckStoreId in class org.neo4j.com.Client<Master>

allocateIds

public org.neo4j.com.Response<IdAllocation> allocateIds(org.neo4j.kernel.IdType idType)
Specified by:
allocateIds in interface Master

createRelationshipType

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

acquireNodeWriteLock

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

acquireNodeReadLock

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

acquireRelationshipWriteLock

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

acquireRelationshipReadLock

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

commitSingleResourceTransaction

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

finishTransaction

public org.neo4j.com.Response<Void> finishTransaction(org.neo4j.com.SlaveContext context)
Specified by:
finishTransaction in interface Master

rollbackOngoingTransactions

public void rollbackOngoingTransactions(org.neo4j.com.SlaveContext context)

pullUpdates

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

getMasterIdForCommittedTx

public org.neo4j.com.Response<Integer> getMasterIdForCommittedTx(long txId)
Specified by:
getMasterIdForCommittedTx in interface Master

copyStore

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

readIdAllocation

protected static IdAllocation readIdAllocation(org.jboss.netty.buffer.ChannelBuffer buffer)


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