syncasync

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bridge

type Bridge interface {
	// Init is required as there's a bi-directional relationship between event manager and syncasync bridge
	Init(sysevents system.EventInterface)

	// WaitForReply waits for a reply to the message with the supplied ID
	WaitForReply(ctx context.Context, id *fftypes.UUID, send SendFunction) (*core.MessageInOut, error)
	// WaitForMessage waits for a message with the supplied ID
	WaitForMessage(ctx context.Context, id *fftypes.UUID, send SendFunction) (*core.Message, error)
	// WaitForIdentity waits for an identity with the supplied ID
	WaitForIdentity(ctx context.Context, id *fftypes.UUID, send SendFunction) (*core.Identity, error)
	// WaitForTokenPool waits for a token pool with the supplied ID
	WaitForTokenPool(ctx context.Context, id *fftypes.UUID, send SendFunction) (*core.TokenPool, error)
	// WaitForTokenTransfer waits for a token transfer with the supplied ID
	WaitForTokenTransfer(ctx context.Context, id *fftypes.UUID, send SendFunction) (*core.TokenTransfer, error)
	// WaitForTokenTransfer waits for a token approval with the supplied ID
	WaitForTokenApproval(ctx context.Context, id *fftypes.UUID, send SendFunction) (*core.TokenApproval, error)
	// WaitForInvokeOperation waits for an operation with the supplied ID
	WaitForInvokeOperation(ctx context.Context, id *fftypes.UUID, send SendFunction) (*core.Operation, error)
	// WaitForDeployOperation waits for an operation with the supplied ID
	WaitForDeployOperation(ctx context.Context, id *fftypes.UUID, send SendFunction) (*core.Operation, error)
}

Bridge translates synchronous (HTTP API) calls, into asynchronously sending a message and blocking until a correlating response is received, or we hit a timeout.

func NewSyncAsyncBridge

func NewSyncAsyncBridge(ctx context.Context, ns string, di database.Plugin, dm data.Manager, om operations.Manager) Bridge

type SendFunction added in v1.1.0

type SendFunction func(ctx context.Context) error

type Sender added in v1.1.0

type Sender interface {
	Prepare(ctx context.Context) error
	Send(ctx context.Context) error
	SendAndWait(ctx context.Context) error
}

Sender interface may be implemented by other types that wish to provide generic sync/async capabilities

Jump to

Keyboard shortcuts

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