lifecycle

package
v2.0.0-beta.5 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Reference

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

Reference is an open reference for some resource.

func (*Reference) Close

func (ref *Reference) Close() error

Close makes a Reference an io.Closer. It is safe to call multiple times.

func (*Reference) Closing

func (ref *Reference) Closing() <-chan struct{}

Closing returns a channel that will be closed when the associated resource begins closing.

func (*Reference) Release

func (ref *Reference) Release()

Release causes the Reference to be freed. It is safe to call multiple times.

type References

type References []*Reference

References is a helper to aggregate a group of references.

func (References) Close

func (refs References) Close() error

Close makes References an io.Closer. It is safe to call multiple times.

func (References) Release

func (refs References) Release()

Release releases all of the references. It is safe to call multiple times.

type Resource

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

Resource keeps track of references and has some compile time debug hooks to help diagnose leaks. It keeps track of if it is open or not and allows blocking until all references are released.

func (*Resource) Acquire

func (res *Resource) Acquire() (*Reference, error)

Acquire returns a Reference used to keep alive some resource.

func (*Resource) Close

func (res *Resource) Close()

Close waits for any outstanding references and marks the resource as closed so that Acquire returns an error.

func (*Resource) Open

func (res *Resource) Open()

Open marks the resource as open.

func (*Resource) Opened

func (res *Resource) Opened() bool

Opened returns true if the resource is currently open. It may be immediately false in the presence of concurrent Open and Close calls.

Jump to

Keyboard shortcuts

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