/** * Get the value of the MTU length used for this log. * * @param metadataBuffer containing the meta data. * @return the value of the MTU length used for this log. */ public static int mtuLength(final UnsafeBuffer metadataBuffer) { return metadataBuffer.getInt(LOG_MTU_LENGTH_OFFSET); }
/** * The current capacity of the buffer. * * @return the current capacity of the buffer. */ public int capacity() { return buffer.capacity(); }
/** * Set the page size used for this log. * * @param metadataBuffer containing the meta data. * @param pageSize value to be set. */ public static void pageSize(final UnsafeBuffer metadataBuffer, final int pageSize) { metadataBuffer.putInt(LOG_PAGE_SIZE_OFFSET, pageSize); }
/** * Wrap a region of an underlying log buffer so can can represent a claimed space for use by a publisher. * * @param buffer to be wrapped. * @param offset at which the claimed region begins including space for the header. * @param length length of the underlying claimed region including space for the header. */ public final void wrap(final AtomicBuffer buffer, final int offset, final int length) { this.buffer.wrap(buffer, offset, length); }
/** * Get the value stored in the reserve space at the end of a data frame header. * <p> * Note: The value is in {@link ByteOrder#LITTLE_ENDIAN} format. * * @return the value stored in the reserve space at the end of a data frame header. * @see io.aeron.protocol.DataHeaderFlyweight */ public final long reservedValue() { return buffer.getLong(RESERVED_VALUE_OFFSET, LITTLE_ENDIAN); }
/** * Get whether the log is considered connected or not by the driver. * * @param metadataBuffer containing the meta data. * @return whether the log is considered connected or not by the driver. */ public static boolean isConnected(final UnsafeBuffer metadataBuffer) { return metadataBuffer.getIntVolatile(LOG_IS_CONNECTED_OFFSET) == 1; }
/** * Set the correlation ID used for this log relating to the command which created it. * * @param metadataBuffer containing the meta data. * @param id value to be set. */ public static void correlationId(final UnsafeBuffer metadataBuffer, final long id) { metadataBuffer.putLong(LOG_CORRELATION_ID_OFFSET, id); }
/** * Get the value of the flags field. * * @return the value of the header flags field. * @see io.aeron.protocol.DataHeaderFlyweight */ public final byte flags() { return buffer.getByte(FLAGS_FIELD_OFFSET); }
DedicatedModeReplayer( final ErrorHandler errorHandler, final AtomicCounter errorCounter, final ManyToOneConcurrentArrayQueue<Session> closeQueue, final int maxConcurrentSessions) { super("archive-replayer", errorHandler); this.closeQueue = closeQueue; this.errorCounter = errorCounter; this.sessionsQueue = new OneToOneConcurrentArrayQueue<>(maxConcurrentSessions); }
/** * Set whether the log is considered connected or not by the driver. * * @param metadataBuffer containing the meta data. * @param isConnected or not */ public static void isConnected(final UnsafeBuffer metadataBuffer, final boolean isConnected) { metadataBuffer.putIntOrdered(LOG_IS_CONNECTED_OFFSET, isConnected ? 1 : 0); }
/** * Create a loss report which wraps a buffer which is ideally memory mapped so it can * be read from another process. * * @param buffer to be wrapped. */ public LossReport(final AtomicBuffer buffer) { buffer.verifyAlignment(); this.buffer = buffer; }
/** * Set the value of the header flags field. * * @param flags value to be set in the header. * @return this for a fluent API. * @see io.aeron.protocol.DataHeaderFlyweight */ public ExclusiveBufferClaim flags(final byte flags) { buffer.putByte(FLAGS_FIELD_OFFSET, flags); return this; }
/** * Set the value of the end of stream position. * * @param metadataBuffer containing the meta data. * @param position value of the end of stream position */ public static void endOfStreamPosition(final UnsafeBuffer metadataBuffer, final long position) { metadataBuffer.putLongOrdered(LOG_END_OF_STREAM_POSITION_OFFSET, position); }
private void invokeAeronClient() { if (null != aeronClientInvoker) { aeronClientInvoker.invoke(); } }
/** * Get the value of the Term Length used for this log. * * @param metadataBuffer containing the meta data. * @return the value of the term length used for this log. */ public static int termLength(final UnsafeBuffer metadataBuffer) { return metadataBuffer.getInt(LOG_TERM_LENGTH_OFFSET); }
/** * Get the value of the correlation ID for this log relating to the command which created it. * * @param metadataBuffer containing the meta data. * @return the value of the correlation ID used for this log. */ public static long correlationId(final UnsafeBuffer metadataBuffer) { return metadataBuffer.getLong(LOG_CORRELATION_ID_OFFSET); }
/** * Get the value of the active term count used by the producer of this log. Consumers may have a different * active term count if they are running behind. The read is done with volatile semantics. * * @param metadataBuffer containing the meta data. * @return the value of the active term count used by the producer of this log. */ public static int activeTermCount(final UnsafeBuffer metadataBuffer) { return metadataBuffer.getIntVolatile(LOG_ACTIVE_TERM_COUNT_OFFSET); }
/** * Is the frame at data frame at the beginning of packet a heartbeat message? * * @param packet containing the data frame. * @param length of the data frame. * @return true if a heartbeat otherwise false. */ public static boolean isHeartbeat(final UnsafeBuffer packet, final int length) { return length == HEADER_LENGTH && packet.getInt(0) == 0; }
/** * Get the value of the initial Term id used for this log. * * @param metadataBuffer containing the meta data. * @return the value of the initial Term id used for this log. */ public static int initialTermId(final UnsafeBuffer metadataBuffer) { return metadataBuffer.getInt(LOG_INITIAL_TERM_ID_OFFSET); }