ccontainer

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CContainer

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

CContainer is a concurrent container.

func NewCContainer

func NewCContainer(val interface{}) *CContainer

NewCContainer builds a CContainer with an initial value.

func (*CContainer) SetValue

func (c *CContainer) SetValue(val interface{})

SetValue sets the ccontainer value.

Be sure to check for nil when setting if necessary: untyped nil is still considered a set value.

func (*CContainer) WaitValue

func (c *CContainer) WaitValue(ctx context.Context, errCh <-chan error) (interface{}, error)

WaitValue waits for any non-nil value in the container. errCh is an optional channel to read an error from.

func (*CContainer) WaitValueChange

func (c *CContainer) WaitValueChange(ctx context.Context, old interface{}, errCh <-chan error) (interface{}, error)

WaitValueChange waits for a value that is different than the given. errCh is an optional channel to read an error from.

func (*CContainer) WaitValueEmpty

func (c *CContainer) WaitValueEmpty(ctx context.Context, errCh <-chan error) error

WaitValueEmpty waits for a untyped nil value. errCh is an optional channel to read an error from.

func (*CContainer) WaitValueWithValidator

func (c *CContainer) WaitValueWithValidator(
	ctx context.Context,
	valid func(v interface{}) (bool, error),
	errCh <-chan error,
) (interface{}, error)

WaitValueWithValidator waits for any value that matches the validator in the container. errCh is an optional channel to read an error from.

Jump to

Keyboard shortcuts

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