v0.0.0-...-e560ebb Latest Latest

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

Go to latest
Published: Jul 13, 2021 License: BSD-3-Clause Imports: 3 Imported by: 0



Package resource helps to manage AIP resources (



This section is empty.


This section is empty.


This section is empty.


type Manager

type Manager struct {
	// contains filtered or unexported fields

Manager tracks resources to support standard AIP methods like Get, Delete, as well as clean up runtime resources when the service exits.

func NewManager

func NewManager() *Manager

NewManager returns a new instance of Manager.

func (*Manager) Add

func (m *Manager) Add(name string, r Resource) error

Add adds a entry in the manager for a resource.

func (*Manager) Close

func (m *Manager) Close()

Close closes the manager and all resources it tracks. Resources added and removed during the Close call may or may not be handled, and resources may be added and removed after calling close. The caller should ensure no more requests can happen before Close is called.

func (*Manager) Remove

func (m *Manager) Remove(name string) (Resource, error)

Remove deletes a resource by name and return it to the caller.

type Resource

type Resource interface {
	// Close closes the resource.
	// It corresponds to any cleanup required by the standard AIP Delete method.
	// It is implementation dependent whether it is safe to call from multiple
	// goroutines.
	// The implementation must be safe to call multiple times.
	Close() error

Resource represents a resource recommended by go/aip.

Jump to

Keyboard shortcuts

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