bridge

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewServer

func NewServer() *rpc.Server

Types

type Bridge

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

func New

func New() *Bridge

func (*Bridge) Apply

func (b *Bridge) Apply(h handle.Handle, res interface{}) (Resource, error)

Apply either creates a shell managed resource of the given handle type using the properties of the map or structure provided, or it applies the properties of the given map or structure to the managed resource by the given handle

func (*Bridge) Close

func (b *Bridge) Close() (err error)

Close discards all known resources

func (*Bridge) Discard

func (b *Bridge) Discard(h handle.Handle) error

Discard closes and releases the shell managed resource by the given handle

func (*Bridge) Sync

func (b *Bridge) Sync(res interface{}) error

Sync takes a pointer to a handled struct, runs it through Apply with its own handle, then applies the resulting resource properties back to the handled struct pointer given

func (*Bridge) Types

func (b *Bridge) Types() []string

Types returns the names of supported resource types

type Resource

type Resource interface {
	// Resource returns a pointer to the handled struct
	Resource() interface{}

	// Apply attempts to apply the handled struct properties
	// to the actual shell managed resource
	Apply() error

	// Discard attempts to close and release the
	// shell managed resource
	Discard() error
}

Jump to

Keyboard shortcuts

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