operations

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: May 27, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateOperationRetryContext

func CreateOperationRetryContext(ctx context.Context) (ctx1 context.Context)

func RunWithOperationCache

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

Types

type Manager

type Manager interface {
	RegisterHandler(ctx context.Context, handler OperationHandler, ops []fftypes.OpType)
	PrepareOperation(ctx context.Context, op *fftypes.Operation) (*fftypes.PreparedOperation, error)
	RunOperation(ctx context.Context, op *fftypes.PreparedOperation, options ...RunOperationOption) (fftypes.JSONObject, error)
	RetryOperation(ctx context.Context, ns string, opID *fftypes.UUID) (*fftypes.Operation, error)
	AddOrReuseOperation(ctx context.Context, op *fftypes.Operation) error
	SubmitOperationUpdate(plugin fftypes.Named, update *OperationUpdate)
	TransferResult(dx dataexchange.Plugin, event dataexchange.DXEvent)
	ResolveOperationByID(ctx context.Context, id string, op *fftypes.Operation) (*fftypes.Operation, error)
	Start() error
	WaitStop()
}

func NewOperationsManager

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

type OperationHandler

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

type OperationUpdate added in v1.0.0

type OperationUpdate struct {
	ID             *fftypes.UUID
	Status         fftypes.OpStatus
	BlockchainTXID string
	ErrorMessage   string
	Output         fftypes.JSONObject
	VerifyManifest bool
	DXManifest     string
	DXHash         string
	OnComplete     func()
}

OperationUpdate is dispatched asynchronously to perform an update.

type RunOperationOption

type RunOperationOption int
const (
	RemainPendingOnFailure RunOperationOption = iota
)

Jump to

Keyboard shortcuts

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