/** * Construct a view over a term buffer and state buffer for appending frames. * * @param termBuffer for where messages are stored. * @param metaDataBuffer for where the state of writers is stored manage concurrency. * @param partitionIndex for this will be the active appender. */ public TermAppender(final UnsafeBuffer termBuffer, final UnsafeBuffer metaDataBuffer, final int partitionIndex) { final int tailCounterOffset = TERM_TAIL_COUNTERS_OFFSET + (partitionIndex * SIZE_OF_LONG); metaDataBuffer.boundsCheck(tailCounterOffset, SIZE_OF_LONG); this.termBuffer = termBuffer; tailAddressOffset = metaDataBuffer.addressOffset() + tailCounterOffset; }
/** * Construct a view over a term buffer and state buffer for appending frames. * * @param termBuffer for where messages are stored. * @param metaDataBuffer for where the state of writers is stored manage concurrency. * @param partitionIndex for this will be the active appender. */ public ExclusiveTermAppender( final UnsafeBuffer termBuffer, final UnsafeBuffer metaDataBuffer, final int partitionIndex) { final int tailCounterOffset = TERM_TAIL_COUNTERS_OFFSET + (partitionIndex * SIZE_OF_LONG); metaDataBuffer.boundsCheck(tailCounterOffset, SIZE_OF_LONG); this.termBuffer = termBuffer; tailAddressOffset = metaDataBuffer.addressOffset() + tailCounterOffset; }
public byte getByte(final int index) { if (SHOULD_BOUNDS_CHECK) { boundsCheck(index); } return getByteWithoutBoundsCheck(index); }
public void putByte(final int index, final byte value) { if (SHOULD_BOUNDS_CHECK) { boundsCheck(index); } putByteWithoutBoundsCheck(index, value); }
public byte getByteVolatile(final int index) { if (SHOULD_BOUNDS_CHECK) { boundsCheck(index); } return UNSAFE.getByteVolatile(byteArray, addressOffset + index); }
public void putByteVolatile(final int index, final byte value) { if (SHOULD_BOUNDS_CHECK) { boundsCheck(index); } UNSAFE.putByteVolatile(byteArray, addressOffset + index, value); }
/** * Map a position over a buffer and this indicator owns the counter for reclamation. * * @param buffer containing the counter. * @param counterId identifier of the counter. * @param countersManager to be used for freeing the counter when this is closed. */ public UnsafeBufferPosition(final UnsafeBuffer buffer, final int counterId, final CountersManager countersManager) { this.counterId = counterId; this.countersManager = countersManager; this.byteArray = buffer.byteArray(); this.byteBuffer = buffer.byteBuffer(); final int counterOffset = CountersManager.counterOffset(counterId); buffer.boundsCheck(counterOffset, SIZE_OF_LONG); this.addressOffset = buffer.addressOffset() + counterOffset; }
public void putByte(final int index, final byte value) { if (SHOULD_BOUNDS_CHECK) { boundsCheck(index); } UNSAFE.putByte(byteArray, addressOffset + index, value); }
public byte getByte(final int index) { if (SHOULD_BOUNDS_CHECK) { boundsCheck(index); } return UNSAFE.getByte(byteArray, addressOffset + index); }
public void putByte(final int index, final byte value) { if (SHOULD_BOUNDS_CHECK) { boundsCheck(index); } putByteWithoutBoundsCheck(index, value); }
public void putByteVolatile(final int index, final byte value) { if (SHOULD_BOUNDS_CHECK) { boundsCheck(index); } UNSAFE.putByteVolatile(byteArray, addressOffset + index, value); }
public void putByteVolatile(final int index, final byte value) { if (SHOULD_BOUNDS_CHECK) { boundsCheck(index); } UNSAFE.putByteVolatile(byteArray, addressOffset + index, value); }
/** * Construct a view over a term buffer and state buffer for appending frames. * * @param termBuffer for where messages are stored. * @param metaDataBuffer for where the state of writers is stored manage concurrency. * @param partitionIndex for this will be the active appender. */ public TermAppender(final UnsafeBuffer termBuffer, final UnsafeBuffer metaDataBuffer, final int partitionIndex) { final int tailCounterOffset = TERM_TAIL_COUNTERS_OFFSET + (partitionIndex * SIZE_OF_LONG); metaDataBuffer.boundsCheck(tailCounterOffset, SIZE_OF_LONG); this.termBuffer = termBuffer; tailAddressOffset = metaDataBuffer.addressOffset() + tailCounterOffset; }
public byte getByte(final int index) { if (SHOULD_BOUNDS_CHECK) { boundsCheck(index); } return getByteWithoutBoundsCheck(index); }
public byte getByteVolatile(final int index) { if (SHOULD_BOUNDS_CHECK) { boundsCheck(index); } return UNSAFE.getByteVolatile(byteArray, addressOffset + index); }
public byte getByteVolatile(final int index) { if (SHOULD_BOUNDS_CHECK) { boundsCheck(index); } return UNSAFE.getByteVolatile(byteArray, addressOffset + index); }
/** * Construct a view over a term buffer and state buffer for appending frames. * * @param termBuffer for where messages are stored. * @param metaDataBuffer for where the state of writers is stored manage concurrency. * @param partitionIndex for this will be the active appender. */ public ExclusiveTermAppender( final UnsafeBuffer termBuffer, final UnsafeBuffer metaDataBuffer, final int partitionIndex) { final int tailCounterOffset = TERM_TAIL_COUNTERS_OFFSET + (partitionIndex * SIZE_OF_LONG); metaDataBuffer.boundsCheck(tailCounterOffset, SIZE_OF_LONG); this.termBuffer = termBuffer; tailAddressOffset = metaDataBuffer.addressOffset() + tailCounterOffset; }
/** * Construct a view over a term buffer and state buffer for appending frames. * * @param termBuffer for where messages are stored. * @param metaDataBuffer for where the state of writers is stored manage concurrency. * @param partitionIndex for this will be the active appender. */ public ExclusiveTermAppender( final UnsafeBuffer termBuffer, final UnsafeBuffer metaDataBuffer, final int partitionIndex) { final int tailCounterOffset = TERM_TAIL_COUNTERS_OFFSET + (partitionIndex * SIZE_OF_LONG); metaDataBuffer.boundsCheck(tailCounterOffset, SIZE_OF_LONG); this.termBuffer = termBuffer; tailAddressOffset = metaDataBuffer.addressOffset() + tailCounterOffset; }
/** * Construct a view over a term buffer and state buffer for appending frames. * * @param termBuffer for where messages are stored. * @param metaDataBuffer for where the state of writers is stored manage concurrency. * @param partitionIndex for this will be the active appender. */ public TermAppender(final UnsafeBuffer termBuffer, final UnsafeBuffer metaDataBuffer, final int partitionIndex) { final int tailCounterOffset = TERM_TAIL_COUNTERS_OFFSET + (partitionIndex * SIZE_OF_LONG); metaDataBuffer.boundsCheck(tailCounterOffset, SIZE_OF_LONG); this.termBuffer = termBuffer; tailAddressOffset = metaDataBuffer.addressOffset() + tailCounterOffset; }
/** * Map a position over a buffer and this indicator owns the counter for reclamation. * * @param buffer containing the counter. * @param counterId identifier of the counter. * @param countersManager to be used for freeing the counter when this is closed. */ public UnsafeBufferPosition(final UnsafeBuffer buffer, final int counterId, final CountersManager countersManager) { this.counterId = counterId; this.countersManager = countersManager; this.buffer = buffer.byteArray(); final int counterOffset = CountersManager.counterOffset(counterId); buffer.boundsCheck(counterOffset, SIZE_OF_LONG); this.addressOffset = buffer.addressOffset() + counterOffset; }