apps

package
v1.9.3 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2022 License: MPL-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("app not found")

Functions

This section is empty.

Types

type Instance

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

Instance describes an app instance known by the Encore daemon.

func NewInstance

func NewInstance(root, localID, platformID string) *Instance

func (*Instance) LocalID

func (i *Instance) LocalID() string

LocalID reports a local, random id unique for this app, as persisted in the .encore/manifest.json file. It always returns a non-empty string.

func (*Instance) PlatformID

func (i *Instance) PlatformID() string

PlatformID reports the Encore Platform's ID for this app. If the app is not linked it reports the empty string.

func (*Instance) PlatformOrLocalID

func (i *Instance) PlatformOrLocalID() string

PlatformOrLocalID reports PlatformID() if set and otherwise LocalID().

func (*Instance) Root

func (i *Instance) Root() string

Root returns the filesystem path for the app root. It always returns a non-empty string.

func (*Instance) Watch added in v1.5.0

func (i *Instance) Watch(fn WatchFunc) error

type Manager

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

Manager keeps track of known apps and watches them for changes.

func NewManager

func NewManager(db *sql.DB) *Manager

func (*Manager) FindLatestByPlatformID

func (mgr *Manager) FindLatestByPlatformID(platformID string) (*Instance, error)

FindLatestByPlatformID finds the most recently updated app instance with the given platformID. If no such app is found it reports an error matching ErrNotFound.

func (*Manager) FindLatestByPlatformOrLocalID added in v1.9.3

func (mgr *Manager) FindLatestByPlatformOrLocalID(id string) (*Instance, error)

func (*Manager) List added in v1.5.0

func (mgr *Manager) List() ([]*Instance, error)

List lists all known apps.

func (*Manager) RegisterAppListener added in v1.5.0

func (mgr *Manager) RegisterAppListener(fn func(*Instance))

RegisterAppListener registers a callback that gets invoked every time an app is tracked.

func (*Manager) Track

func (mgr *Manager) Track(appRoot string) (*Instance, error)

Track begins tracking an app, and marks it as updated if the app is already tracked.

func (*Manager) WatchAll added in v1.5.0

func (mgr *Manager) WatchAll(fn WatchFunc) error

WatchAll watches all apps for changes.

type WatchFunc added in v1.5.0

type WatchFunc func(*Instance, notify.EventInfo)

WatchFunc is the signature of functions registered as app watchers.

Jump to

Keyboard shortcuts

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