meta

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 14, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Metadata

type Metadata struct {
	// contains filtered or unexported fields
}

Metadata only needs 80B to store the Metadata for the pipe. But for memory alignment, it takes at least one memory page size, which is generally 4K.

[ 8Bit ][ 8Bit ][ 8Bit ][ 8Bit ][ 8Bit ][ 8Bit ][ 8Bit ][ 8Bit ][ 8Bit ][ 8Bit ] [metaVersion][ ID ][ offset][ ID ][ offset][ ID ][ offset][ ID ][ offset][capacity] [metaVersion][writing offset][watermark offset][committed offset][reading offset][capacity]

func NewMetaData

func NewMetaData(metaDir string, capacity int) (*Metadata, error)

NewMetaData read or create a Metadata with supported metaVersion

func (*Metadata) Close

func (m *Metadata) Close() error

Close do Flush operation and unmap the memory mapped file.

func (*Metadata) Flush

func (m *Metadata) Flush() error

Flush the memory mapped file to the disk.

func (*Metadata) GetCapacity

func (m *Metadata) GetCapacity() int

GetCapacity returns the capacity of the queue.

func (*Metadata) GetCommittedOffset

func (m *Metadata) GetCommittedOffset() (segmentID, offset int64)

GetCommittedOffset returns the committed offset, which contains the segment ID and the offset of the segment.

func (*Metadata) GetReadingOffset

func (m *Metadata) GetReadingOffset() (segmentID, offset int64)

GetReadingOffset returns the reading offset, which contains the segment ID and the offset of the segment.

func (*Metadata) GetVersion

func (m *Metadata) GetVersion() int

GetVersion returns the meta version.

func (*Metadata) GetWatermarkOffset

func (m *Metadata) GetWatermarkOffset() (segmentID, offset int64)

GetWatermarkOffset returns the watermark offset, which contains the segment ID and the offset of the segment.

func (*Metadata) GetWritingOffset

func (m *Metadata) GetWritingOffset() (segmentID, offset int64)

GetWritingOffset returns the writing offset, which contains the segment ID and the offset of the segment.

func (*Metadata) PutCapacity

func (m *Metadata) PutCapacity(version int64)

PutCapacity put the capacity into the memory mapped file.

func (*Metadata) PutCommittedOffset

func (m *Metadata) PutCommittedOffset(segmentID, offset int64)

PutCommittedOffset put the segment ID and the offset of the segment into the committed offset.

func (*Metadata) PutReadingOffset

func (m *Metadata) PutReadingOffset(segmentID, offset int64)

PutReadingOffset put the segment ID and the offset of the segment into the reading offset.

func (*Metadata) PutVersion

func (m *Metadata) PutVersion(version int64)

PutVersion put the version into the memory mapped file.

func (*Metadata) PutWatermarkOffset

func (m *Metadata) PutWatermarkOffset(segmentID, offset int64)

PutWatermarkOffset put the segment ID and the offset of the segment into the watermark offset.

func (*Metadata) PutWritingOffset

func (m *Metadata) PutWritingOffset(segmentID, offset int64)

PutWritingOffset put the segment ID and the offset of the segment into the writing offset.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL