transactions

package
v0.0.0-...-2d02f19 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithCustomExecutor

func WithCustomExecutor(executor pool.Executor) options.WithOption

WithCustomExecutor sets a custom Executor for the RequestTransactionManager

Types

type CompletionFuture deprecated

type CompletionFuture interface {
	pool.CompletionFuture
}

Deprecated: don't use it in productive code

type Executor deprecated

type Executor interface {
	pool.Executor
}

Deprecated: don't use it in productive code

type RequestTransaction

type RequestTransaction interface {
	fmt.Stringer
	// FailRequest signals that this transaction has failed
	FailRequest(err error) error
	// EndRequest signals that this transaction is done
	EndRequest() error
	// Submit submits a RequestTransactionRunnable to the RequestTransactionManager
	Submit(operation RequestTransactionRunnable)
	// AwaitCompletion wait for this RequestTransaction to finish. Returns an error if it finished unsuccessful
	AwaitCompletion(ctx context.Context) error
	// IsCompleted indicates that the that this RequestTransaction is completed
	IsCompleted() bool
}

RequestTransaction represents a transaction

type RequestTransactionManager

type RequestTransactionManager interface {
	io.Closer
	// CloseGraceful gives some time opposed to io.Closer
	CloseGraceful(timeout time.Duration) error
	// SetNumberOfConcurrentRequests sets the number of concurrent requests that will be sent out to a device
	SetNumberOfConcurrentRequests(numberOfConcurrentRequests int)
	// StartTransaction starts a RequestTransaction
	StartTransaction() RequestTransaction
}

RequestTransactionManager handles transactions

func NewRequestTransactionManager

func NewRequestTransactionManager(numberOfConcurrentRequests int, _options ...options.WithOption) RequestTransactionManager

NewRequestTransactionManager creates a new RequestTransactionManager

type RequestTransactionRunnable

type RequestTransactionRunnable func(RequestTransaction)

Jump to

Keyboard shortcuts

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