org.neo4j.kernel.ha
Class MasterClient
java.lang.Object
org.neo4j.com.Client<Master>
org.neo4j.kernel.ha.MasterClient
- All Implemented Interfaces:
- org.jboss.netty.channel.ChannelPipelineFactory, Master
public class MasterClient
- extends 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.
|
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 ds,
long startTxId,
long endTxId)
|
Response<Integer> |
createRelationshipType(SlaveContext context,
String name)
|
Response<Void> |
finishTransaction(SlaveContext context,
boolean success)
|
Response<Pair<Integer,Long>> |
getMasterIdForCommittedTx(long txId,
StoreId storeId)
Gets the master id for a given txId, also a checksum for that tx. |
protected int |
getReadTimeout(RequestType<Master> type,
int readTimeout)
|
Response<Void> |
initializeTx(SlaveContext context)
Called when the first write operation of lock is performed for a transaction. |
Response<Void> |
pullUpdates(SlaveContext context)
|
protected static IdAllocation |
readIdAllocation(org.jboss.netty.buffer.ChannelBuffer buffer)
|
void |
rollbackOngoingTransactions(SlaveContext context)
|
protected boolean |
shouldCheckStoreId(RequestType<Master> type)
|
| Methods inherited from class org.neo4j.com.Client |
closeChannel, getInternalProtocolVersion, getMyStoreId, getPipeline, readTransactionStreamHeader, readTransactionStreams, releaseChannel, sendRequest, sendRequest, shutdown, toString, writeContext |
LOCK_RESULT_DESERIALIZER
protected static final Deserializer<LockResult> LOCK_RESULT_DESERIALIZER
MasterClient
public MasterClient(String hostNameOrIp,
int port,
AbstractGraphDatabase graphDb,
Client.ConnectionLostHandler connectionLostHandler,
int readTimeoutSeconds,
int lockReadTimeout,
int maxConcurrentChannels)
getReadTimeout
protected int getReadTimeout(RequestType<Master> type,
int readTimeout)
- Overrides:
getReadTimeout in class Client<Master>
shouldCheckStoreId
protected boolean shouldCheckStoreId(RequestType<Master> type)
- Overrides:
shouldCheckStoreId in class Client<Master>
allocateIds
public Response<IdAllocation> allocateIds(IdType idType)
- Specified by:
allocateIds in interface Master
createRelationshipType
public Response<Integer> createRelationshipType(SlaveContext context,
String name)
- Specified by:
createRelationshipType in interface Master
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
acquireNodeWriteLock
public Response<LockResult> acquireNodeWriteLock(SlaveContext context,
long... nodes)
- Specified by:
acquireNodeWriteLock in interface Master
acquireNodeReadLock
public Response<LockResult> acquireNodeReadLock(SlaveContext context,
long... nodes)
- Specified by:
acquireNodeReadLock in interface Master
acquireRelationshipWriteLock
public Response<LockResult> acquireRelationshipWriteLock(SlaveContext context,
long... relationships)
- Specified by:
acquireRelationshipWriteLock in interface Master
acquireRelationshipReadLock
public Response<LockResult> acquireRelationshipReadLock(SlaveContext context,
long... relationships)
- Specified by:
acquireRelationshipReadLock 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
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
rollbackOngoingTransactions
public void rollbackOngoingTransactions(SlaveContext context)
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 ds,
long startTxId,
long endTxId)
- Specified by:
copyTransactions in interface Master
readIdAllocation
protected static IdAllocation readIdAllocation(org.jboss.netty.buffer.ChannelBuffer buffer)
Copyright © 2002-2012 The Neo4j Graph Database Project. All Rights Reserved.