org.neo4j.kernel.impl.index
Class IndexCommand
java.lang.Object
org.neo4j.kernel.impl.transaction.xaframework.XaCommand
org.neo4j.kernel.impl.index.IndexCommand
- Direct Known Subclasses:
- IndexCommand.AddCommand, IndexCommand.AddRelationshipCommand, IndexCommand.CreateCommand, IndexCommand.DeleteCommand, IndexCommand.RemoveCommand
public abstract class IndexCommand
- extends XaCommand
Created from IndexDefineCommand or read from a logical log.
Contains all the different types of commands that an Index need
to support.
NODE
public static final byte NODE
- See Also:
- Constant Field Values
RELATIONSHIP
public static final byte RELATIONSHIP
- See Also:
- Constant Field Values
getIndexNameId
public byte getIndexNameId()
getEntityType
public byte getEntityType()
getEntityId
public long getEntityId()
getKeyId
public byte getKeyId()
getValue
public Object getValue()
execute
public void execute()
- Description copied from class:
XaCommand
- Executes the command and makes it persistent. This method must succeed,
any protests about this command not being able to execute should be done
before execution of any command within the transaction.
- Specified by:
execute in class XaCommand
writeToFile
public void writeToFile(LogBuffer buffer)
throws IOException
- Description copied from class:
XaCommand
- When a command is added to a transaction (usually when it is created) it
must be written to the
XaLogicalLog. This method should write
all the data that is needed to re-create the command (see
XaCommandFactory).
Write the data to the fileChannel, you can use the
buffer supplied or create your own buffer since its capacity
is very small (137 bytes or something). Acccess to writing commands is
synchronized, only one command will be written at a time so if you need
to write larger data sets the commands can share the same buffer.
Don't throw an IOException to imply something is wrong
with the command. An exception should only be thrown here if there is a
real IO failure. If something is wrong with this command it should have
been detected when it was created.
Don't force, position or anything except
normal forward write with the file channel.
- Specified by:
writeToFile in class XaCommand
- Parameters:
buffer - A small byte buffer that can be used to write command data
- Throws:
IOException - In case of *real* IO failure
writeHeader
protected void writeHeader(LogBuffer buffer)
throws IOException
- Throws:
IOException
putIntOrLong
protected static void putIntOrLong(LogBuffer buffer,
long id)
throws IOException
- Throws:
IOException
needsLong
protected static byte needsLong(long value)
startNodeNeedsLong
protected byte startNodeNeedsLong()
endNodeNeedsLong
protected byte endNodeNeedsLong()
isConsideredNormalWriteCommand
public boolean isConsideredNormalWriteCommand()
readCommand
public static XaCommand readCommand(ReadableByteChannel channel,
ByteBuffer buffer)
throws IOException
- Throws:
IOException
equals
public boolean equals(Object obj)
- Overrides:
equals in class Object
Copyright © 2002-2012 The Neo4j Graph Database Project. All Rights Reserved.