oplog

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 20, 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
	FlowIdIndexBucket   = []byte("oplog.flow_id_idx")  // flow_id_index tracks IDs of operations affecting a given flow
	InstanceIndexBucket = []byte("oplog.instance_idx") // instance_id_index tracks IDs of operations affecting a given instance
	SnapshotIndexBucket = []byte("oplog.snapshot_idx") // snapshot_index tracks IDs of operations affecting a given snapshot
)
View Source
var CurrentVersion = int64(len(migrations))
View Source
var ErrNotExist = errors.New("operation does not exist")
View Source
var ErrStopIteration = errors.New("stop iteration")

Functions

func ApplyMigrations added in v1.0.0

func ApplyMigrations(oplog *OpLog, tx *bbolt.Tx) error

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) ForEach added in v1.0.0

func (o *OpLog) ForEach(query Query, 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

type Query added in v1.0.0

type Query struct {
	RepoId     string
	PlanId     string
	SnapshotId string
	FlowId     int64
	InstanceId string
	Ids        []int64
}

Query represents a query to the operation log.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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