Documentation ¶
Index ¶
- Variables
- type Instance
- func (i *Instance) CacheMetadata(md *meta.Data) error
- func (i *Instance) CachePath() (string, error)
- func (i *Instance) CachedMetadata() (*meta.Data, error)
- func (i *Instance) Close() error
- func (i *Instance) Experiments(environ []string) (*experiments.Set, error)
- func (i *Instance) GlobalCORS() (appfile.CORS, error)
- func (i *Instance) Lang() appfile.Lang
- func (i *Instance) LocalID() string
- func (i *Instance) Name() string
- func (i *Instance) PlatformID() string
- func (i *Instance) PlatformOrLocalID() string
- func (i *Instance) Root() string
- func (i *Instance) Unwatch(id WatchSubscriptionID)
- func (i *Instance) Watch(fn WatchFunc) (WatchSubscriptionID, error)
- type Manager
- func (mgr *Manager) Close() error
- func (mgr *Manager) FindLatestByPlatformID(platformID string) (*Instance, error)
- func (mgr *Manager) FindLatestByPlatformOrLocalID(id string) (*Instance, error)
- func (mgr *Manager) List() ([]*Instance, error)
- func (mgr *Manager) RegisterAppListener(fn func(*Instance))
- func (mgr *Manager) Track(appRoot string) (*Instance, error)
- func (mgr *Manager) WatchAll(fn WatchFunc) error
- type WatchFunc
- type WatchSubscriptionID
Constants ¶
This section is empty.
Variables ¶
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 (*Instance) CacheMetadata ¶ added in v1.31.0
CacheMetadata caches the metadata for this app onto the file system
func (*Instance) CachePath ¶ added in v1.31.0
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
CachedMetadata returns the cached metadata for this app, if any
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
GlobalCORS returns the CORS configuration for the app which will be applied against all API gateways into the app
func (*Instance) LocalID ¶
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
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 ¶
PlatformID reports the Encore Platform's ID for this app. If the app is not linked it reports the empty string.
func (*Instance) PlatformOrLocalID ¶
PlatformOrLocalID reports PlatformID() if set and otherwise LocalID().
func (*Instance) Root ¶
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)
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager keeps track of known apps and watches them for changes.
func NewManager ¶
func (*Manager) FindLatestByPlatformID ¶
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 (*Manager) RegisterAppListener ¶ added in v1.5.0
RegisterAppListener registers a callback that gets invoked every time an app is tracked.
type WatchFunc ¶ added in v1.5.0
WatchFunc is the signature of functions registered as app watchers.
type WatchSubscriptionID ¶ added in v1.11.0
type WatchSubscriptionID int64