log

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

START: intro

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrOffsetOutOfRange = errors.New("the requested offset is outside the log's range")
)

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 *Record) (uint64, error)

func (*Log) Close

func (l *Log) Close() error

func (*Log) GetLog

func (l *Log) GetLog(index uint64, out *Record) error

func (*Log) HighestOffset

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

func (*Log) LowestOffset

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

LowestOffset To know what nodes have the oldest and newest data and what nodes are falling behind and need to replicate.

func (*Log) Read

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

func (*Log) Reader

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

func (*Log) Remove

func (l *Log) Remove() error

func (*Log) Reset

func (l *Log) Reset() error

func (*Log) StoreLogs

func (l *Log) StoreLogs(records []*Record) error

func (*Log) Truncate

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

Truncate (In the future, periodically) call Truncate to remove old segments whose data we (hopefully) have processed by then and don’t need anymore.

type Record

type Record struct {
	Value  interface{}
	Offset uint64
}

Jump to

Keyboard shortcuts

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