segment

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Backup

func Backup(segments []Segment, dir string) error

func BackupDir

func BackupDir(dir, target string) error

func CheckDir

func CheckDir(dir string, params index.Params) error

func Consume

func Consume[S ~[]O, O Offsetter](segments S, offset int64) (O, int)

func Get

func Get[S ~[]O, O Offsetter](segments S, offset int64) (O, int, error)

func RecoverDir

func RecoverDir(dir string, params index.Params) error

Types

type Offsetter

type Offsetter interface {
	GetOffset() int64
}

type RewriteSegment

type RewriteSegment struct {
	Segment Segment
	Stats   Stats

	SurviveOffsets map[int64]struct{}
	DeletedOffsets map[int64]struct{}
	DeletedSize    int64
}

func (*RewriteSegment) GetNewSegment

func (r *RewriteSegment) GetNewSegment() Segment

type Segment

type Segment struct {
	Dir    string
	Offset int64

	Log   string
	Index string
}

func Find

func Find(dir string) ([]Segment, error)

func New

func New(dir string, offset int64) Segment

func (Segment) Backup

func (s Segment) Backup(targetDir string) error

func (Segment) Check

func (s Segment) Check(params index.Params) error

func (Segment) ForRewrite

func (s Segment) ForRewrite() (Segment, error)

func (Segment) GetOffset

func (s Segment) GetOffset() int64

func (Segment) NeedsReindex

func (s Segment) NeedsReindex() (bool, error)

func (Segment) Override

func (olds Segment) Override(news Segment) error

func (Segment) Recover

func (s Segment) Recover(params index.Params) error

func (Segment) Reindex

func (s Segment) Reindex(params index.Params) ([]index.Item, error)

func (Segment) ReindexAndReadIndex

func (s Segment) ReindexAndReadIndex(params index.Params) ([]index.Item, error)

func (Segment) ReindexReader

func (s Segment) ReindexReader(params index.Params, log *message.Reader) ([]index.Item, error)

func (Segment) Remove

func (s Segment) Remove() error

func (Segment) Rename

func (olds Segment) Rename(news Segment) error

func (Segment) Rewrite

func (src Segment) Rewrite(dropOffsets map[int64]struct{}, params index.Params) (*RewriteSegment, error)

func (Segment) Stat

func (s Segment) Stat(params index.Params) (Stats, error)

type Stats

type Stats struct {
	Segments int
	Messages int
	Size     int64
}

func Stat

func Stat(segments []Segment, params index.Params) (Stats, error)

func StatDir

func StatDir(dir string, params index.Params) (Stats, error)

Jump to

Keyboard shortcuts

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