org.neo4j.com
Class BlockLogBuffer

java.lang.Object
  extended by org.neo4j.com.BlockLogBuffer
All Implemented Interfaces:
org.neo4j.kernel.impl.transaction.xaframework.LogBuffer

public class BlockLogBuffer
extends Object
implements org.neo4j.kernel.impl.transaction.xaframework.LogBuffer

Implementation of a LogBuffer over a ChannelBuffer. Maintains a byte buffer of content which is flushed to the underlying channel when a maximum size is reached. It is supposed to be used with BlockLogReader.

Every chunk is exactly 256 bytes in length, except for the last one which can be anything greater than one and up to 256. This is signaled via the first byte which is 0 for every non-last chunk and the actual number of bytes for the last one (always > 0).


Constructor Summary
BlockLogBuffer(org.jboss.netty.buffer.ChannelBuffer target)
           
 
Method Summary
 void done()
          Signals the end of use for this buffer over this channel - first byte of the chunk is set to the position of the buffer ( != 0, instead of FULL_BLOCK_AND_MORE) and it is written to the channel.
 void force()
           
 FileChannel getFileChannel()
           
 long getFileChannelPosition()
           
 org.neo4j.kernel.impl.transaction.xaframework.LogBuffer put(byte b)
           
 org.neo4j.kernel.impl.transaction.xaframework.LogBuffer put(byte[] bytes)
           
 org.neo4j.kernel.impl.transaction.xaframework.LogBuffer put(char[] chars)
           
 org.neo4j.kernel.impl.transaction.xaframework.LogBuffer putDouble(double d)
           
 org.neo4j.kernel.impl.transaction.xaframework.LogBuffer putFloat(float f)
           
 org.neo4j.kernel.impl.transaction.xaframework.LogBuffer putInt(int i)
           
 org.neo4j.kernel.impl.transaction.xaframework.LogBuffer putLong(long l)
           
 org.neo4j.kernel.impl.transaction.xaframework.LogBuffer putShort(short s)
           
 int write(ReadableByteChannel data)
           
 void writeOut()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BlockLogBuffer

public BlockLogBuffer(org.jboss.netty.buffer.ChannelBuffer target)
Method Detail

put

public org.neo4j.kernel.impl.transaction.xaframework.LogBuffer put(byte b)
                                                            throws IOException
Specified by:
put in interface org.neo4j.kernel.impl.transaction.xaframework.LogBuffer
Throws:
IOException

putShort

public org.neo4j.kernel.impl.transaction.xaframework.LogBuffer putShort(short s)
                                                                 throws IOException
Specified by:
putShort in interface org.neo4j.kernel.impl.transaction.xaframework.LogBuffer
Throws:
IOException

putInt

public org.neo4j.kernel.impl.transaction.xaframework.LogBuffer putInt(int i)
                                                               throws IOException
Specified by:
putInt in interface org.neo4j.kernel.impl.transaction.xaframework.LogBuffer
Throws:
IOException

putLong

public org.neo4j.kernel.impl.transaction.xaframework.LogBuffer putLong(long l)
                                                                throws IOException
Specified by:
putLong in interface org.neo4j.kernel.impl.transaction.xaframework.LogBuffer
Throws:
IOException

putFloat

public org.neo4j.kernel.impl.transaction.xaframework.LogBuffer putFloat(float f)
                                                                 throws IOException
Specified by:
putFloat in interface org.neo4j.kernel.impl.transaction.xaframework.LogBuffer
Throws:
IOException

putDouble

public org.neo4j.kernel.impl.transaction.xaframework.LogBuffer putDouble(double d)
                                                                  throws IOException
Specified by:
putDouble in interface org.neo4j.kernel.impl.transaction.xaframework.LogBuffer
Throws:
IOException

put

public org.neo4j.kernel.impl.transaction.xaframework.LogBuffer put(byte[] bytes)
                                                            throws IOException
Specified by:
put in interface org.neo4j.kernel.impl.transaction.xaframework.LogBuffer
Throws:
IOException

put

public org.neo4j.kernel.impl.transaction.xaframework.LogBuffer put(char[] chars)
                                                            throws IOException
Specified by:
put in interface org.neo4j.kernel.impl.transaction.xaframework.LogBuffer
Throws:
IOException

writeOut

public void writeOut()
              throws IOException
Specified by:
writeOut in interface org.neo4j.kernel.impl.transaction.xaframework.LogBuffer
Throws:
IOException

force

public void force()
           throws IOException
Specified by:
force in interface org.neo4j.kernel.impl.transaction.xaframework.LogBuffer
Throws:
IOException

getFileChannelPosition

public long getFileChannelPosition()
                            throws IOException
Specified by:
getFileChannelPosition in interface org.neo4j.kernel.impl.transaction.xaframework.LogBuffer
Throws:
IOException

getFileChannel

public FileChannel getFileChannel()
Specified by:
getFileChannel in interface org.neo4j.kernel.impl.transaction.xaframework.LogBuffer

done

public void done()
Signals the end of use for this buffer over this channel - first byte of the chunk is set to the position of the buffer ( != 0, instead of FULL_BLOCK_AND_MORE) and it is written to the channel.


write

public int write(ReadableByteChannel data)
          throws IOException
Throws:
IOException


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