operations

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrTernary added in v1.3.0

func ErrTernary(err error, ifErr, ifNoError core.OpPhase) core.OpPhase

func RunWithOperationContext added in v1.1.0

func RunWithOperationContext(ctx context.Context, fn func(ctx context.Context) error) error

Types

type ConflictError added in v1.3.0

type ConflictError interface {
	IsConflictError() bool
}

ConflictError can be implemented by connectors to prevent an operation being overridden to failed

type Manager

type Manager interface {
	RegisterHandler(ctx context.Context, handler OperationHandler, ops []core.OpType)
	PrepareOperation(ctx context.Context, op *core.Operation) (*core.PreparedOperation, error)
	RunOperation(ctx context.Context, op *core.PreparedOperation, idempotentSubmit bool) (fftypes.JSONObject, error)
	RetryOperation(ctx context.Context, opID *fftypes.UUID) (*core.Operation, error)
	ResubmitOperations(ctx context.Context, txID *fftypes.UUID) (total int, resubmit []*core.Operation, err error)
	AddOrReuseOperation(ctx context.Context, op *core.Operation, hooks ...database.PostCompletionHook) error
	BulkInsertOperations(ctx context.Context, ops ...*core.Operation) error
	SubmitOperationUpdate(update *core.OperationUpdate)
	GetOperationByIDCached(ctx context.Context, opID *fftypes.UUID) (*core.Operation, error)
	ResolveOperationByID(ctx context.Context, opID *fftypes.UUID, op *core.OperationUpdateDTO) error
	Start() error
	WaitStop()
}

func NewOperationsManager

func NewOperationsManager(ctx context.Context, ns string, di database.Plugin, txHelper txcommon.Helper, cacheManager cache.Manager) (Manager, error)

type OperationHandler

type OperationHandler interface {
	core.Named
	PrepareOperation(ctx context.Context, op *core.Operation) (*core.PreparedOperation, error)
	RunOperation(ctx context.Context, op *core.PreparedOperation) (outputs fftypes.JSONObject, phase core.OpPhase, err error)
	OnOperationUpdate(ctx context.Context, op *core.Operation, update *core.OperationUpdate) error
}

Jump to

Keyboard shortcuts

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