db

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunGC added in v0.2.0

func RunGC(db *badger.DB) error

func WriteProto added in v0.2.0

func WriteProto(db *badger.DB) func(p protos.ID) error

Types

type Process

type Process func(value []byte) error

type Runner

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

Runner provides streaming operations on badger.DB.

func NewRunner

func NewRunner(path string, parallel int) *Runner

func (*Runner) Process

func (r *Runner) Process(
	ctx context.Context,
	cancel context.CancelCauseFunc,
	process Process,
) (*sync.WaitGroup, error)

Process runs process on each Value in the database. process must be thread-safe as it may be called simultaneously by multiple threads.

Returns a WaitGroup which finishes after the last Value from the DB has been processed.

func (*Runner) ProcessIDs

func (r *Runner) ProcessIDs(
	ctx context.Context,
	cancel context.CancelCauseFunc,
	process Process,
	ids <-chan uint32,
) (*sync.WaitGroup, error)

ProcessIDs runs process on each id's corresponding value. process must be thread-safe as it may be called simultaneously by multiple threads.

Returns a WaitGroup which finishes after the last id has been processed.

Jump to

Keyboard shortcuts

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