oplog

package
v0.17.2 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventTypeUnknown   = EventType(iota)
	EventTypeOpCreated = EventType(iota)
	EventTypeOpUpdated = EventType(iota)
)

Variables

View Source
var (
	SystemBucket        = []byte("oplog.system")       // system stores metadata
	OpLogBucket         = []byte("oplog.log")          // oplog stores existant operations.
	RepoIndexBucket     = []byte("oplog.repo_idx")     // repo_index tracks IDs of operations affecting a given repo
	PlanIndexBucket     = []byte("oplog.plan_idx")     // plan_index tracks IDs of operations affecting a given plan
	SnapshotIndexBucket = []byte("oplog.snapshot_idx") // snapshot_index tracks IDs of operations affecting a given snapshot
)
View Source
var ErrNotExist = errors.New("operation does not exist")
View Source
var ErrStopIteration = errors.New("stop iteration")

Functions

This section is empty.

Types

type EventType

type EventType int

type OpLog

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

OpLog represents a log of operations performed. Operations are indexed by repo and plan.

func NewOpLog

func NewOpLog(databasePath string) (*OpLog, error)

func (*OpLog) Add

func (o *OpLog) Add(op *v1.Operation) error

Add adds a generic operation to the operation log.

func (*OpLog) BulkAdd

func (o *OpLog) BulkAdd(ops []*v1.Operation) error

func (*OpLog) Close

func (o *OpLog) Close() error

func (*OpLog) Delete

func (o *OpLog) Delete(ids ...int64) error

func (*OpLog) ForAll

func (o *OpLog) ForAll(do func(op *v1.Operation) error) error

func (*OpLog) ForEachByPlan

func (o *OpLog) ForEachByPlan(planId string, collector indexutil.Collector, do func(op *v1.Operation) error) error

func (*OpLog) ForEachByRepo

func (o *OpLog) ForEachByRepo(repoId string, collector indexutil.Collector, do func(op *v1.Operation) error) error

func (*OpLog) ForEachBySnapshotId

func (o *OpLog) ForEachBySnapshotId(snapshotId string, collector indexutil.Collector, do func(op *v1.Operation) error) error

func (*OpLog) Get

func (o *OpLog) Get(id int64) (*v1.Operation, error)

func (*OpLog) Scan

func (o *OpLog) Scan(onIncomplete func(op *v1.Operation)) error

Scan checks the log for incomplete operations. Should only be called at startup.

func (*OpLog) Subscribe

func (o *OpLog) Subscribe(callback *func(*v1.Operation, *v1.Operation))

func (*OpLog) Unsubscribe

func (o *OpLog) Unsubscribe(callback *func(*v1.Operation, *v1.Operation))

func (*OpLog) Update

func (o *OpLog) Update(op *v1.Operation) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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