Documentation ¶
Index ¶
- Constants
- Variables
- func ComputeMaxMessageLength(capacity int32) int32
- func FrameFlags(logBuffer *atomic.Buffer, frameOffset int32, flags uint8)
- func GetFlags(logBuffer *atomic.Buffer, frameOffset int32) uint8
- func GetFrameLength(logBuffer *atomic.Buffer, frameOffset int32) int32
- func GetSessionId(logBuffer *atomic.Buffer, frameOffset int32) int32
- func GetStreamId(logBuffer *atomic.Buffer, frameOffset int32) int32
- func GetTermId(logBuffer *atomic.Buffer, frameOffset int32) int32
- func IsPaddingFrame(logBuffer *atomic.Buffer, frameOffset int32) bool
- func RotateLog(logMetaDataBuffer *LogBufferMetaData, currentTermCount int32, ...)
- func SetFrameLength(logBuffer *atomic.Buffer, frameOffset int32, frameLength int32)
- func SetFrameType(logBuffer *atomic.Buffer, frameOffset int32, typ uint16)
- func TermID(rawTail int64) int32
- type Claim
- func (claim *Claim) Abort()
- func (claim *Claim) Buffer() *atomic.Buffer
- func (claim *Claim) Commit()
- func (claim *Claim) Length() int32
- func (claim *Claim) Offset() int32
- func (claim *Claim) ReservedValue() int64
- func (claim *Claim) SetReservedValue(value int64) *Claim
- func (c *Claim) Wrap(buf *atomic.Buffer, offset, length int32)
- type Header
- func (hdr *Header) Flags() uint8
- func (hdr *Header) FrameLength() int32
- func (hdr *Header) InitialTermId() int32
- func (hdr *Header) Offset() int32
- func (hdr *Header) Position() int64
- func (hdr *Header) SessionId() int32
- func (hdr *Header) SetInitialTermID(initialTermID int32) *Header
- func (hdr *Header) SetOffset(offset int32) *Header
- func (hdr *Header) SetPositionBitsToShift(positionBitsToShift int32) *Header
- func (hdr *Header) StreamId() int32
- func (hdr *Header) TermId() int32
- func (hdr *Header) Wrap(ptr unsafe.Pointer, length int32) *Header
- type LogBufferMetaData
- type LogBuffers
Constants ¶
const ( Clean int32 = 0 NeedsCleaning = 1 PartitionCount = 3 LogMetaDataSectionIndex = PartitionCount TermMinLength int32 = 64 * 1024 LogMetaDataLength = pageMinSize )
const ( // FrameAlignment frame alignment FrameAlignment int32 = 32 )
Variables ¶
var DataFrameHeader = struct { FrameLengthFieldOffset int32 VersionFieldOffset int32 FlagsFieldOffset int32 TypeFieldOffset int32 TermOffsetFieldOffset int32 SessionIDFieldOffset int32 StreamIDFieldOffset int32 TermIDFieldOffset int32 ReservedValueFieldOffset int32 DataOffset int32 Length int32 TypePad uint16 TypeData uint16 TypeNAK uint16 TypeSM uint16 TypeErr uint16 TypeSetup uint16 TypeExt uint16 CurrentVersion int8 }{ 0, 4, 5, 6, 8, 12, 16, 20, 24, 32, 32, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0xFFFF, 0x0, }
Functions ¶
func ComputeMaxMessageLength ¶
func RotateLog ¶
func RotateLog(logMetaDataBuffer *LogBufferMetaData, currentTermCount int32, currentTermId int32)
func SetFrameLength ¶
Types ¶
type Claim ¶
type Claim struct {
// contains filtered or unexported fields
}
func (*Claim) Abort ¶
func (claim *Claim) Abort()
Abort a claim of the message space to the log buffer so that the log can progress by ignoring this claim.
func (*Claim) Commit ¶
func (claim *Claim) Commit()
Commit the message to the log buffer so that is it available to subscribers.
func (*Claim) Length ¶
The length of the claimed range in the buffer.
@return length of the range in the buffer.
func (*Claim) Offset ¶
offset in the buffer at which the claimed range begins.
@return offset in the buffer at which the range begins.
func (*Claim) ReservedValue ¶
Get the value stored in the reserve space at the end of a data frame header.
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 DataHeaderFlyweight
func (*Claim) SetReservedValue ¶
Write the provided value into the reserved space at the end of the data frame header.
Note: The value will be written in {@link ByteOrder#LITTLE_ENDIAN} format.
@param value to be stored in the reserve space at the end of a data frame header. @return this for fluent API semantics. @see DataHeaderFlyweight
type Header ¶
type Header struct {
// contains filtered or unexported fields
}
func (*Header) FrameLength ¶
func (*Header) InitialTermId ¶
func (*Header) Position ¶
Position calculates the current position to which the image has advanced on reading this message.
func (*Header) SetInitialTermID ¶
func (*Header) SetPositionBitsToShift ¶
type LogBufferMetaData ¶
type LogBufferMetaData struct { flyweight.FWBase TailCounter []flyweight.Int64Field // 0, 8, 16 ActiveTermCountOff flyweight.Int32Field // 24 EndOfStreamPosOff flyweight.Int64Field // 128 IsConnected flyweight.Int32Field // 136 CorrelationId flyweight.Int64Field // 256 InitTermID flyweight.Int32Field // 264 DefaultFrameHdrLen flyweight.Int32Field // 270 MTULen flyweight.Int32Field // 274 TermLen flyweight.Int32Field // 278 PageSize flyweight.Int32Field // 282 DefaultFrameHeader flyweight.RawDataField // 384 // contains filtered or unexported fields }
LogBufferMetaData is the flyweight for LogBuffer meta data * <pre> * 0 1 2 3 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | Tail Counter 0 | * | | * +---------------------------------------------------------------+ * | Tail Counter 1 | * | | * +---------------------------------------------------------------+ * | Tail Counter 2 | * | | * +---------------------------------------------------------------+ * | Active Term Count | * +---------------------------------------------------------------+ * | Cache Line Padding ... * ... | * +---------------------------------------------------------------+ * | End of Stream Position | * | | * +---------------------------------------------------------------+ * | Is Connected | * +---------------------------------------------------------------+ * | Cache Line Padding ... * ... | * +---------------------------------------------------------------+ * | Registration / Correlation ID | * | | * +---------------------------------------------------------------+ * | Initial Term Id | * +---------------------------------------------------------------+ * | Default Frame Header Length | * +---------------------------------------------------------------+ * | MTU Length | * +---------------------------------------------------------------+ * | Term Length | * +---------------------------------------------------------------+ * | Page Size | * +---------------------------------------------------------------+ * | Cache Line Padding ... * ... | * +---------------------------------------------------------------+ * | Default Frame Header ... * ... | * +---------------------------------------------------------------+ * </pre>
type LogBuffers ¶
type LogBuffers struct {
// contains filtered or unexported fields
}
LogBuffers is the struct providing access to the file or files representing the terms containing the ring buffer
func Wrap ¶
func Wrap(fileName string) *LogBuffers
Wrap is the factory method wrapping the LogBuffers structure around memory mapped file
func (*LogBuffers) Buffer ¶
func (logBuffers *LogBuffers) Buffer(index int) *atomic.Buffer
Buffer returns a buffer backing a specific term based on index. PartitionLength+1 is the size of the buffer array, and the last buffer is the metadata buffer, which can be accessed through a convenience wrapped via Meta() method.
func (*LogBuffers) Close ¶
func (logBuffers *LogBuffers) Close() error
Close will try to unmap all backing memory maps
func (*LogBuffers) Meta ¶
func (logBuffers *LogBuffers) Meta() *LogBufferMetaData
Meta return log buffer meta data flyweight