org.neo4j.kernel.ha
Class MasterClient20

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

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

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 MasterClient20.AcquireIndexLockSerializer
           
protected static class MasterClient20.AcquireLockSerializer
           
 
Field Summary
static byte PROTOCOL_VERSION
           
 
Fields inherited from class org.neo4j.com.Client
DEFAULT_MAX_NUMBER_OF_CONCURRENT_CHANNELS_PER_CLIENT, DEFAULT_READ_RESPONSE_TIMEOUT_SECONDS
 
Fields inherited from interface org.neo4j.kernel.ha.com.slave.MasterClient
LOCK_RESULT_DESERIALIZER, LOCK_SERIALIZER
 
Constructor Summary
MasterClient20(String hostNameOrIp, int port, org.neo4j.kernel.logging.Logging logging, org.neo4j.kernel.impl.nioneo.store.StoreId storeId, long readTimeoutSeconds, long lockReadTimeout, int maxConcurrentChannels, int chunkSize)
           
MasterClient20(URI masterUri, org.neo4j.kernel.logging.Logging logging, org.neo4j.kernel.impl.nioneo.store.StoreId storeId, org.neo4j.kernel.configuration.Config config)
           
 
Method Summary
 org.neo4j.com.Response<LockResult> acquireGraphReadLock(org.neo4j.com.RequestContext context)
           
 org.neo4j.com.Response<LockResult> acquireGraphWriteLock(org.neo4j.com.RequestContext context)
           
 org.neo4j.com.Response<LockResult> acquireIndexReadLock(org.neo4j.com.RequestContext context, String index, String key)
           
 org.neo4j.com.Response<LockResult> acquireIndexWriteLock(org.neo4j.com.RequestContext context, String index, String key)
           
 org.neo4j.com.Response<LockResult> acquireNodeReadLock(org.neo4j.com.RequestContext context, long... nodes)
           
 org.neo4j.com.Response<LockResult> acquireNodeWriteLock(org.neo4j.com.RequestContext context, long... nodes)
           
 org.neo4j.com.Response<LockResult> acquireRelationshipReadLock(org.neo4j.com.RequestContext context, long... relationships)
           
 org.neo4j.com.Response<LockResult> acquireRelationshipWriteLock(org.neo4j.com.RequestContext context, long... relationships)
           
 org.neo4j.com.Response<LockResult> acquireSchemaReadLock(org.neo4j.com.RequestContext context)
           
 org.neo4j.com.Response<LockResult> acquireSchemaWriteLock(org.neo4j.com.RequestContext context)
           
 org.neo4j.com.Response<IdAllocation> allocateIds(org.neo4j.kernel.IdType idType)
           
 org.neo4j.com.Response<Long> commitSingleResourceTransaction(org.neo4j.com.RequestContext context, String resource, org.neo4j.com.TxExtractor txGetter)
           
 org.neo4j.com.Response<Void> copyStore(org.neo4j.com.RequestContext context, org.neo4j.com.StoreWriter writer)
           
 org.neo4j.com.Response<Void> copyTransactions(org.neo4j.com.RequestContext context, String ds, long startTxId, long endTxId)
           
 org.neo4j.com.Response<Integer> createPropertyKey(org.neo4j.com.RequestContext context, String name)
           
 org.neo4j.com.Response<Integer> createRelationshipType(org.neo4j.com.RequestContext context, String name)
           
 org.neo4j.com.Response<Void> finishTransaction(org.neo4j.com.RequestContext context, boolean success)
           
 org.neo4j.com.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.
protected  long getReadTimeout(org.neo4j.com.RequestType<Master> type, long readTimeout)
           
 org.neo4j.com.Response<Void> initializeTx(org.neo4j.com.RequestContext context)
          Called when the first write operation of lock is performed for a transaction.
 org.neo4j.com.Response<Void> pullUpdates(org.neo4j.com.RequestContext context)
           
 org.neo4j.com.Response<Void> pushTransaction(org.neo4j.com.RequestContext context, String resourceName, long tx)
           
protected static IdAllocation readIdAllocation(org.jboss.netty.buffer.ChannelBuffer buffer)
           
 void rollbackOngoingTransactions(org.neo4j.com.RequestContext context)
           
protected  boolean shouldCheckStoreId(org.neo4j.com.RequestType<Master> type)
           
 
Methods inherited from class org.neo4j.com.Client
addMismatchingVersionHandler, closeChannel, getInternalProtocolVersion, getPipeline, getStoreId, readTransactionStreamHeader, readTransactionStreams, releaseChannel, sendRequest, sendRequest, start, stop, toString, writeContext
 
Methods inherited from class org.neo4j.kernel.lifecycle.LifecycleAdapter
init, shutdown
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.neo4j.kernel.ha.com.slave.MasterClient
addMismatchingVersionHandler
 

Field Detail

PROTOCOL_VERSION

public static final byte PROTOCOL_VERSION
See Also:
Constant Field Values
Constructor Detail

MasterClient20

public MasterClient20(String hostNameOrIp,
                      int port,
                      org.neo4j.kernel.logging.Logging logging,
                      org.neo4j.kernel.impl.nioneo.store.StoreId storeId,
                      long readTimeoutSeconds,
                      long lockReadTimeout,
                      int maxConcurrentChannels,
                      int chunkSize)

MasterClient20

public MasterClient20(URI masterUri,
                      org.neo4j.kernel.logging.Logging logging,
                      org.neo4j.kernel.impl.nioneo.store.StoreId storeId,
                      org.neo4j.kernel.configuration.Config config)
Method Detail

getReadTimeout

protected long getReadTimeout(org.neo4j.com.RequestType<Master> type,
                              long readTimeout)
Overrides:
getReadTimeout in class org.neo4j.com.Client<Master>

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.RequestContext context,
                                                              String name)
Specified by:
createRelationshipType in interface Master
Specified by:
createRelationshipType in interface MasterClient

createPropertyKey

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

initializeTx

public org.neo4j.com.Response<Void> initializeTx(org.neo4j.com.RequestContext 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
Specified by:
initializeTx in interface MasterClient

acquireNodeWriteLock

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

acquireNodeReadLock

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

acquireRelationshipWriteLock

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

acquireRelationshipReadLock

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

acquireGraphWriteLock

public org.neo4j.com.Response<LockResult> acquireGraphWriteLock(org.neo4j.com.RequestContext context)
Specified by:
acquireGraphWriteLock in interface Master
Specified by:
acquireGraphWriteLock in interface MasterClient

acquireGraphReadLock

public org.neo4j.com.Response<LockResult> acquireGraphReadLock(org.neo4j.com.RequestContext context)
Specified by:
acquireGraphReadLock in interface Master
Specified by:
acquireGraphReadLock in interface MasterClient

acquireIndexReadLock

public org.neo4j.com.Response<LockResult> acquireIndexReadLock(org.neo4j.com.RequestContext context,
                                                               String index,
                                                               String key)
Specified by:
acquireIndexReadLock in interface Master
Specified by:
acquireIndexReadLock in interface MasterClient

acquireIndexWriteLock

public org.neo4j.com.Response<LockResult> acquireIndexWriteLock(org.neo4j.com.RequestContext context,
                                                                String index,
                                                                String key)
Specified by:
acquireIndexWriteLock in interface Master
Specified by:
acquireIndexWriteLock in interface MasterClient

acquireSchemaReadLock

public org.neo4j.com.Response<LockResult> acquireSchemaReadLock(org.neo4j.com.RequestContext context)
Specified by:
acquireSchemaReadLock in interface Master

acquireSchemaWriteLock

public org.neo4j.com.Response<LockResult> acquireSchemaWriteLock(org.neo4j.com.RequestContext context)
Specified by:
acquireSchemaWriteLock in interface Master

commitSingleResourceTransaction

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

finishTransaction

public org.neo4j.com.Response<Void> finishTransaction(org.neo4j.com.RequestContext context,
                                                      boolean success)
Specified by:
finishTransaction in interface Master
Specified by:
finishTransaction in interface MasterClient

rollbackOngoingTransactions

public void rollbackOngoingTransactions(org.neo4j.com.RequestContext context)
Specified by:
rollbackOngoingTransactions in interface MasterClient

pullUpdates

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

getMasterIdForCommittedTx

public org.neo4j.com.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 org.neo4j.com.Response<Void> copyStore(org.neo4j.com.RequestContext context,
                                              org.neo4j.com.StoreWriter writer)
Specified by:
copyStore in interface Master
Specified by:
copyStore in interface MasterClient

copyTransactions

public org.neo4j.com.Response<Void> copyTransactions(org.neo4j.com.RequestContext context,
                                                     String ds,
                                                     long startTxId,
                                                     long endTxId)
Specified by:
copyTransactions in interface Master
Specified by:
copyTransactions in interface MasterClient

pushTransaction

public org.neo4j.com.Response<Void> pushTransaction(org.neo4j.com.RequestContext context,
                                                    String resourceName,
                                                    long tx)
Specified by:
pushTransaction in interface Master

readIdAllocation

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


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