async

package
v0.0.0-...-1d14c1d Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Initializer

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

Initializer is a helper struct to initialize a changefeed asynchronously.

func NewInitializer

func NewInitializer() *Initializer

NewInitializer creates a new initializer.

func (*Initializer) Terminate

func (initializer *Initializer) Terminate()

Terminate terminates the initializer. It will cancel the initialization if it is initializing. and wait for the initialization to finish. It's not thread-safe.

func (*Initializer) TryInitialize

func (initializer *Initializer) TryInitialize(ctx context.Context,
	initFunc func(ctx context.Context) error,
	pool workerpool.AsyncPool,
) (bool, error)

TryInitialize tries to initialize the module asynchronously. returns true if the module is already initialized or initialized successfully. returns false if the module is initializing or failed to initialize. returns error if the module failed to initialize. It will only initialize the module once. It's not thread-safe.

Jump to

Keyboard shortcuts

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