appops

package
v0.13.3 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2024 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetLatestVersion added in v0.13.0

func GetLatestVersion(versions map[domain.Version]domain.AppListingVersion) (domain.Version, error)

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

func GetValidChangelog(r io.Reader, version semver.Version) (string, error)

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

func URLFromListing(listingURL, baseURL, relPath string) (string, error)

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) Commit

Commit creates either a new app and version, or just a new version

func (*AppGetter) Delete

func (g *AppGetter) Delete(key domain.AppGetKey)

Delete removes the files and the key

func (*AppGetter) DeleteKeyData

func (g *AppGetter) DeleteKeyData(key domain.AppGetKey)

DeleteKeyData removes the data related to the key but leaves files in place.

func (*AppGetter) GetLastEvent

func (g *AppGetter) GetLastEvent(key domain.AppGetKey) (domain.AppGetEvent, bool)

GetLastEvent returns the last event for the key

func (*AppGetter) GetLocationKey

func (g *AppGetter) GetLocationKey(key domain.AppGetKey) (string, bool)

func (*AppGetter) GetResults

func (g *AppGetter) GetResults(key domain.AppGetKey) (domain.AppGetMeta, bool)

func (*AppGetter) GetUser

func (g *AppGetter) GetUser(key domain.AppGetKey) (domain.UserID, bool)

GetUser returns the user associated with the key Used to authorize a request for data on that key

func (*AppGetter) Init

func (g *AppGetter) Init()

Init creates the map [and starts the timers]

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 (g *AppGetter) InstallNewVersionFromURL(userID domain.UserID, appID domain.AppID, version domain.Version) (domain.AppGetKey, error)

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.

func (*AppGetter) Reprocess

func (g *AppGetter) Reprocess(userID domain.UserID, appID domain.AppID, locationKey string) (domain.AppGetKey, error)

Reprocess performs the app processing steps again, replacing the results upon completion. Currently only intended for use by ds-dev.

func (*AppGetter) Stop

func (g *AppGetter) Stop()

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"`
}

func (*DeleteApp) Delete

func (d *DeleteApp) Delete(appID domain.AppID) error

func (*DeleteApp) DeleteVersion

func (d *DeleteApp) DeleteVersion(appID domain.AppID, version domain.Version) error

DeleteVersion removes the app version code and db entry from the system.

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

func (r *RemoteAppGetter) FetchChangelog(listingURL string, version domain.Version) (string, error)

need fetch remote changelog here.

func (*RemoteAppGetter) FetchIcon added in v0.13.0

func (r *RemoteAppGetter) FetchIcon(listingURL string, version domain.Version) ([]byte, error)

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

Jump to

Keyboard shortcuts

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