apps

package
v1.35.3 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: MPL-2.0 Imports: 21 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) CacheMetadata added in v1.31.0

func (i *Instance) CacheMetadata(md *meta.Data) error

CacheMetadata caches the metadata for this app onto the file system

func (*Instance) CachePath added in v1.31.0

func (i *Instance) CachePath() (string, error)

CachePath returns the path to the cache directory for this app. It creates the directory if it does not exist.

func (*Instance) CachedMetadata added in v1.31.0

func (i *Instance) CachedMetadata() (*meta.Data, error)

CachedMetadata returns the cached metadata for this app, if any

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) Name added in v1.31.0

func (i *Instance) Name() string

Name returns the platform ID for the app, or if there isn't one it returns the folder name the app is in.

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