checkpoint

package
v1.3.1-0...-83f5247 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2021 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// DebugCheckpoint is a switch used to debug if:
	// - The context passed to checkpoint is generated by checkpoint.NewContext
	// - multilple context acquire applied to the same context belone to the sampe goroutine
	DebugCheckpoint = os.Getenv("DEBUG_CHECKPOINT") == "1"
)

Functions

func HasCheckPoint

func HasCheckPoint() bool

HasCheckPoint returns if SetCheckPoint has been called

func NewContext

func NewContext(ctx context.Context) context.Context

NewContext wraps given context with value needed by checkpoint

func SetCheckPoint

func SetCheckPoint(file string) error

SetCheckPoint set global checkpoint for replay

Types

type CheckField

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

CheckField is a field that should be checked

func Field

func Field(name string, eq func(interface{}, interface{}) bool) CheckField

Field returns new CheckField

type CheckPoint

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

CheckPoint provides the ability to recover from a failed command at the failpoint

func NewCheckPoint

func NewCheckPoint(r io.Reader) (*CheckPoint, error)

NewCheckPoint returns a CheckPoint by given audit file

type FieldSet

type FieldSet struct {
	set.AnySet
}

FieldSet is an ordered set stores fields and comparators, it's []CheckField

func Register

func Register(fields ...CheckField) FieldSet

Register register FieldSet to global for latter comparing If there are two fields with the same name, the first one will be used

func (*FieldSet) Slice

func (fs *FieldSet) Slice() []CheckField

Slice returns CheckField slice for iteration

type Point

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

Point is a point of checkpoint

func Acquire

func Acquire(ctx context.Context, fs FieldSet, point map[string]interface{}) *Point

Acquire wraps CheckPoint.Acquire

func (*Point) Hit

func (p *Point) Hit() map[string]interface{}

Hit returns value of the point, it will be nil if not hit.

func (*Point) Release

func (p *Point) Release(err error, fields ...zapcore.Field)

Release write checkpoint into log file

Jump to

Keyboard shortcuts

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