wait

package
v3.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2019 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Wait

func Wait(waitables ...Waitable) error

Wait blocks until all the given `algolia.Waitable` objects have completed. If one of the objects returned an error upon `Wait` invocation, this error is returned. Otherwise, nil is returned.

Types

type Group

type Group struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewGroup

func NewGroup() *Group

NewGroup returns a newly instantiated `Group` object. This instance can collect objects implementing the `algolia.Waitable` interface, including most of the Algolia response objects, and wait for their completion in a concurrent fashion.

func (*Group) Collect

func (a *Group) Collect(waitables ...Waitable)

Collect holds references to the given `algolia.Waitable` objects in order to wait for their completion once the `Wait` method will be invoked. Calling `Collect` from multiple goroutines is safe.

func (*Group) Wait

func (a *Group) Wait() error

Wait blocks until all the collected `algolia.Waitable` objects have completed. If one of the objects returned an error upon `Wait` invocation, this error is returned. Otherwise, nil is returned. Calling `Wait` from multiple goroutines is safe.

Upon successful completion, the `Group` object can be reused directly to collect other `algolia.Waitable` objects.

type Waitable

type Waitable interface {
	Wait() error
}

Waitable represents any asynchronous and potentially long-blocking operation which may eventually fail. Most of Algolia response objects are implementing the `algolia.Waitable` interface in order to wait for their completion using `algolia.NewGroup()` or `algolia.Wait()` provided helpers.

Jump to

Keyboard shortcuts

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