Documentation ¶
Index ¶
- func GetLatestVersion(versions map[domain.Version]domain.AppListingVersion) (domain.Version, error)
- func GetSortedVersions(versions map[domain.Version]domain.AppListingVersion) ([]domain.Version, error)
- func GetValidChangelog(r io.Reader, version semver.Version) (string, error)
- func URLFromListing(listingURL, baseURL, relPath string) (string, error)
- func ValidateListing(listing domain.AppListing) error
- type AppGetter
- func (g *AppGetter) Commit(key domain.AppGetKey) (domain.AppID, domain.Version, error)
- func (g *AppGetter) Delete(key domain.AppGetKey)
- func (g *AppGetter) DeleteKeyData(key domain.AppGetKey)
- func (g *AppGetter) GetLastEvent(key domain.AppGetKey) (domain.AppGetEvent, bool)
- func (g *AppGetter) GetLocationKey(key domain.AppGetKey) (string, bool)
- func (g *AppGetter) GetResults(key domain.AppGetKey) (domain.AppGetMeta, bool)
- func (g *AppGetter) GetUser(key domain.AppGetKey) (domain.UserID, bool)
- func (g *AppGetter) Init()
- func (g *AppGetter) InstallFromURL(userID domain.UserID, listingURL string, version domain.Version, ...) (domain.AppGetKey, error)
- func (g *AppGetter) InstallNewVersionFromURL(userID domain.UserID, appID domain.AppID, version domain.Version) (domain.AppGetKey, error)
- func (g *AppGetter) InstallPackage(userID domain.UserID, locationKey string, appIDs ...domain.AppID) (domain.AppGetKey, error)
- func (g *AppGetter) Reprocess(userID domain.UserID, appID domain.AppID, locationKey string) (domain.AppGetKey, error)
- func (g *AppGetter) Stop()
- type DeleteApp
- type RemoteAppGetter
- func (r *RemoteAppGetter) ChangeURL(appID domain.AppID, url string) error
- func (r *RemoteAppGetter) EnsureFreshListing(appID domain.AppID) (listing domain.AppListing, urlData domain.AppURLData, err error)
- func (r *RemoteAppGetter) FetchCachedListing(url string) (domain.AppListingFetch, error)
- func (r *RemoteAppGetter) FetchChangelog(listingURL string, version domain.Version) (string, error)
- func (r *RemoteAppGetter) FetchIcon(listingURL string, version domain.Version) ([]byte, error)
- func (r *RemoteAppGetter) FetchNewVersionManifest(appID domain.AppID, version domain.Version) (domain.AppGetMeta, error)
- func (r *RemoteAppGetter) FetchPackageJob(url string) (string, error)
- func (r *RemoteAppGetter) FetchUrlVersionManifest(listingUrl string, version domain.Version) (domain.AppGetMeta, error)
- func (r *RemoteAppGetter) FetchValidListing(url string) (domain.AppListingFetch, error)
- func (r *RemoteAppGetter) Init()
- func (r *RemoteAppGetter) RefreshAppListing(appID domain.AppID) error
- func (r *RemoteAppGetter) Stop()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetLatestVersion ¶ added in v0.13.0
GetLatestVersion should maybe be pulled out into reusable utility package?
func GetSortedVersions ¶ added in v0.13.0
func GetSortedVersions(versions map[domain.Version]domain.AppListingVersion) ([]domain.Version, error)
GetSortedVersions sorts versions from newest to oldest.
func GetValidChangelog ¶ added in v0.13.0
GetValidChangelog returns the part of the changelog readable from r that matches version as a string. The line containing the version is not included in the returned string.
func URLFromListing ¶ added in v0.13.0
URLFromListing returns a URL for a relative path of a listing It assumes values passed are already sanitzed. maybe this should not be exported? If it needs to be used externally it needs to be injected.
func ValidateListing ¶ added in v0.13.0
func ValidateListing(listing domain.AppListing) error
Types ¶
type AppGetter ¶
type AppGetter struct { AppFilesModel interface { ExtractPackage(locationKey string) error GetManifestSize(string) (int64, error) ReadManifest(string) (domain.AppVersionManifest, error) WriteRoutes(string, []byte) error WriteFileLink(string, string, string) error Delete(string) error } `checkinject:"required"` AppLocation2Path interface { Files(string) string } `checkinject:"required"` AppModel interface { Create(domain.UserID) (domain.AppID, error) CreateFromURL(domain.UserID, string, bool, domain.AppListingFetch) (domain.AppID, error) GetAppUrlListing(domain.AppID) (domain.AppListing, domain.AppURLData, error) CreateVersion(domain.AppID, string, domain.AppVersionManifest) (domain.AppVersion, error) GetVersionsForApp(domain.AppID) ([]*domain.AppVersion, error) } `checkinject:"required"` AppLogger interface { Log(locationKey string, source string, message string) } `checkinject:"required"` RemoteAppGetter interface { EnsureFreshListing(domain.AppID) (domain.AppListing, domain.AppURLData, error) FetchValidListing(url string) (domain.AppListingFetch, error) FetchPackageJob(url string) (string, error) } `checkinject:"required"` SandboxManager interface { ForApp(appVersion *domain.AppVersion) (domain.SandboxI, error) } `checkinject:"required"` AppRoutes interface { ValidateRoutes(routes []domain.AppRoute) error } `checkinject:"required"` AppGetterEvents interface { Send(domain.AppGetEvent) } `checkinject:"required"` // contains filtered or unexported fields }
AppGetter handles incoming application files It can stash them temporarily and examine its metadata for consistency And it can commit files to become an actual app version
func (*AppGetter) DeleteKeyData ¶
DeleteKeyData removes the data related to the key but leaves files in place.
func (*AppGetter) GetLastEvent ¶
GetLastEvent returns the last event for the key
func (*AppGetter) GetLocationKey ¶
func (*AppGetter) GetResults ¶
func (*AppGetter) GetUser ¶
GetUser returns the user associated with the key Used to authorize a request for data on that key
func (*AppGetter) InstallFromURL ¶ added in v0.13.0
func (g *AppGetter) InstallFromURL(userID domain.UserID, listingURL string, version domain.Version, autoRefreshListing bool) (domain.AppGetKey, error)
InstallFromURL installs a new app from a URL
func (*AppGetter) InstallNewVersionFromURL ¶ added in v0.13.0
func (*AppGetter) InstallPackage ¶ added in v0.11.0
func (g *AppGetter) InstallPackage(userID domain.UserID, locationKey string, appIDs ...domain.AppID) (domain.AppGetKey, error)
InstallPackage extracts the package at location key and begins process of extracting and verifying all data.
type DeleteApp ¶
type DeleteApp struct { AppFilesModel interface { Delete(string) error } `checkinject:"required"` AppModel interface { GetVersionsForApp(appID domain.AppID) ([]*domain.AppVersion, error) GetVersion(appID domain.AppID, version domain.Version) (domain.AppVersion, error) Delete(appID domain.AppID) error DeleteVersion(domain.AppID, domain.Version) error } `checkinject:"required"` AppspaceModel interface { GetForApp(appID domain.AppID) ([]*domain.Appspace, error) GetForAppVersion(appID domain.AppID, version domain.Version) ([]*domain.Appspace, error) } `checkinject:"required"` AppLogger interface { Forget(string) } `checkinject:"required"` }
type RemoteAppGetter ¶ added in v0.13.0
type RemoteAppGetter struct { Config *domain.RuntimeConfig `checkinject:"required"` AppFilesModel interface { SavePackage(io.Reader) (string, error) } `checkinject:"required"` AppModel interface { GetAppUrlData(domain.AppID) (domain.AppURLData, error) GetAppUrlListing(domain.AppID) (domain.AppListing, domain.AppURLData, error) GetAutoUrlDataByLastDt(time.Time) ([]domain.AppID, error) SetLastFetch(domain.AppID, time.Time, string) error SetListing(domain.AppID, domain.AppListingFetch) error SetNewUrl(domain.AppID, string, time.Time) error UpdateURL(appID domain.AppID, url string, listingFetch domain.AppListingFetch) error GetVersionsForApp(domain.AppID) ([]*domain.AppVersion, error) } `checkinject:"required"` // contains filtered or unexported fields }
func (*RemoteAppGetter) ChangeURL ¶ added in v0.13.0
func (r *RemoteAppGetter) ChangeURL(appID domain.AppID, url string) error
func (*RemoteAppGetter) EnsureFreshListing ¶ added in v0.13.0
func (r *RemoteAppGetter) EnsureFreshListing(appID domain.AppID) (listing domain.AppListing, urlData domain.AppURLData, err error)
func (*RemoteAppGetter) FetchCachedListing ¶ added in v0.13.0
func (r *RemoteAppGetter) FetchCachedListing(url string) (domain.AppListingFetch, error)
FetchCachedListing always gets from cached listing if it's available
func (*RemoteAppGetter) FetchChangelog ¶ added in v0.13.0
need fetch remote changelog here.
func (*RemoteAppGetter) FetchNewVersionManifest ¶ added in v0.13.0
func (r *RemoteAppGetter) FetchNewVersionManifest(appID domain.AppID, version domain.Version) (domain.AppGetMeta, error)
func (*RemoteAppGetter) FetchPackageJob ¶ added in v0.13.0
func (r *RemoteAppGetter) FetchPackageJob(url string) (string, error)
FetchAppPackage from remote URL Creates location and returns locationKey as string
func (*RemoteAppGetter) FetchUrlVersionManifest ¶ added in v0.13.0
func (r *RemoteAppGetter) FetchUrlVersionManifest(listingUrl string, version domain.Version) (domain.AppGetMeta, error)
FetchUrlVersionManifest fetches the app manifest for the listing at listgingUrl and version or the latest version if version is zero-value.
func (*RemoteAppGetter) FetchValidListing ¶ added in v0.13.0
func (r *RemoteAppGetter) FetchValidListing(url string) (domain.AppListingFetch, error)
func (*RemoteAppGetter) Init ¶ added in v0.13.0
func (r *RemoteAppGetter) Init()
Init the periodic refreshing of app listings
func (*RemoteAppGetter) RefreshAppListing ¶ added in v0.13.0
func (r *RemoteAppGetter) RefreshAppListing(appID domain.AppID) error
func (*RemoteAppGetter) Stop ¶ added in v0.13.0
func (r *RemoteAppGetter) Stop()
Stop the periodic refreshing of app listings