log

package
v0.0.0-...-7df14c5 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LEN_WIDTH = 8
)

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)

NewLog sets defaults for the configs, creates an instance, and sets up it.

func (*Log) Append

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

func (*Log) Close

func (l *Log) Close() error

func (*Log) HighestOffset

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

func (*Log) LowestOffset

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

func (*Log) Read

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

func (*Log) Reader

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

Reader returns an io.Reader to read the whole log.

func (*Log) Remove

func (l *Log) Remove() error

func (*Log) Reset

func (l *Log) Reset() error

func (*Log) Truncate

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

Truncate removes all segments whose highest offset is lower than lowest

Jump to

Keyboard shortcuts

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