oplog

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2024 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrStopIteration = errors.New("stop iteration")
	ErrNotExist      = errors.New("operation does not exist")
	ErrExist         = errors.New("operation already exists")

	NullOPID = int64(0)
)
View Source
var CurrentVersion = int64(len(migrations))
View Source
var SelectAll = Query{}

Functions

func ApplyMigrations added in v1.0.0

func ApplyMigrations(oplog *OpLog) error

Types

type OpLog

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

func NewOpLog

func NewOpLog(store OpStore) (*OpLog, error)

func (*OpLog) Add

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

func (*OpLog) Delete

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

func (*OpLog) Get

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

func (*OpLog) Query added in v1.5.0

func (o *OpLog) Query(q Query, f func(*v1.Operation) error) error

func (*OpLog) Subscribe

func (o *OpLog) Subscribe(q Query, f *Subscription)

func (*OpLog) Transform added in v1.5.0

func (o *OpLog) Transform(q Query, f func(*v1.Operation) (*v1.Operation, error)) error

func (*OpLog) Unsubscribe

func (o *OpLog) Unsubscribe(f *Subscription) error

func (*OpLog) Update

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

type OpStore added in v1.5.0

type OpStore interface {
	Query(q Query, f func(*v1.Operation) error) error
	Get(opID int64) (*v1.Operation, error)
	Add(op ...*v1.Operation) error
	Update(op ...*v1.Operation) error              // returns the previous values of the updated operations OR an error
	Delete(opID ...int64) ([]*v1.Operation, error) // returns the deleted operations OR an error
	Transform(q Query, f func(*v1.Operation) (*v1.Operation, error)) error
	Version() (int64, error)
	SetVersion(version int64) error
}

type OperationEvent added in v1.5.0

type OperationEvent int
const (
	OPERATION_ADDED OperationEvent = iota
	OPERATION_UPDATED
	OPERATION_DELETED
)

type Query added in v1.0.0

type Query struct {
	// Filter by fields
	OpIDs      []int64
	PlanID     string
	RepoID     string
	SnapshotID string
	FlowID     int64
	InstanceID string

	// Pagination
	Limit    int
	Offset   int
	Reversed bool
	// contains filtered or unexported fields
}

func (*Query) Match added in v1.5.0

func (q *Query) Match(op *v1.Operation) bool

type Subscription added in v1.5.0

type Subscription = func(ops []*v1.Operation, event OperationEvent)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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