log

package
v0.0.0-...-108922d Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2022 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Segment struct {
		MaxStoreBytes uint64
		MaxIndexBytes uint64
		InitialOffset uint64
	}
}

type Log

type Log struct {
	Dir    string
	Config Config
	// contains filtered or unexported fields
}

func NewLog

func NewLog(dir string, c Config) (*Log, error)

func (*Log) Append

func (l *Log) Append(record *api.Record) (uint64, error)

Append appends a record to the log.

func (*Log) Close

func (l *Log) Close() error

Close closes the all segments in the log.

func (*Log) HighestOffset

func (l *Log) HighestOffset() (uint64, error)

HighestOffset returns the highest offset of the log.

func (*Log) LowestOffset

func (l *Log) LowestOffset() (uint64, error)

LowestOffset returns the lowest base offset of the log. Conditions: - the log contains at least one segment

func (*Log) Read

func (l *Log) Read(off uint64) (*api.Record, error)

Read reads a record from the log with the given offset.

func (*Log) Reader

func (l *Log) Reader() io.Reader

Reader returns a MultiReader which reads all segments in the log.

func (*Log) Remove

func (l *Log) Remove() error

Remove removes the log directory and all segment files.

func (*Log) Reset

func (l *Log) Reset() error

Reset remove the log and setup a new one.

func (*Log) Truncate

func (l *Log) Truncate(lowest uint64) error

Truncate removes the segments which have a next offset less than the given offset. This method is used to remove old segments in order to free up disk space.

Jump to

Keyboard shortcuts

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