apps

package
v1.12.1 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2022 License: MPL-2.0 Imports: 15 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) Close added in v1.11.0

func (i *Instance) Close() error

func (*Instance) Experiments added in v1.10.1

func (i *Instance) Experiments(environ []string) (*experiments.Set, error)

Experiments returns the enabled experiments for this app.

Note: we read the app file here instead of a cached value so we can detect changes between runs of the compiler if we're in watch mode.

func (*Instance) GlobalCORS added in v1.11.0

func (i *Instance) GlobalCORS() (appfile.CORS, error)

GlobalCORS returns the CORS configuration for the app which will be applied against all API gateways into the app

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) Unwatch added in v1.11.0

func (i *Instance) Unwatch(id WatchSubscriptionID)

func (*Instance) Watch added in v1.5.0

func (i *Instance) Watch(fn WatchFunc) (WatchSubscriptionID, 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) Close added in v1.11.0

func (mgr *Manager) Close() error

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, []watcher.Event)

WatchFunc is the signature of functions registered as app watchers.

type WatchSubscriptionID added in v1.11.0

type WatchSubscriptionID int64

Jump to

Keyboard shortcuts

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