cache

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2020 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Asset

type Asset struct {
	ID                 int64      `json:"id"`
	Name               string     `json:"name"`
	URL                string     `json:"url"`
	BrowserDownloadURL string     `json:"browserDownloadURL"`
	ContentType        string     `json:"contentType"`
	Size               int        `json:"size"`
	Yml                *LatestYml `json:"latestYml"`
}

Asset is the released package.

type GithubCache

type GithubCache struct {
	// contains filtered or unexported fields
}

GithubCache caches release information fetching from github.

func NewGithubCache

func NewGithubCache(conf *GithubConfig, cacheDir string, proxyDownload bool, cacheURLBase string) *GithubCache

NewGithubCache .

func (*GithubCache) AssetFilePath

func (g *GithubCache) AssetFilePath(release *Release, assetName string) string

AssetFilePath generates file path for caching asset.

func (*GithubCache) AssetFileURL

func (g *GithubCache) AssetFileURL(release *Release, assetName string) string

AssetFileURL generates file download url of cached asset.

func (*GithubCache) LoadCache

func (g *GithubCache) LoadCache() *Release

LoadCache gets latest asset info.

func (*GithubCache) Stop added in v1.0.0

func (g *GithubCache) Stop()

Stop the cache services.

type GithubConfig

type GithubConfig struct {
	Owner string `yaml:"owner"`
	Repo  string `yaml:"repo"`
	Token string `yaml:"token"`
}

GithubConfig of the cache

func (*GithubConfig) IsPrivateRepo

func (c *GithubConfig) IsPrivateRepo() bool

IsPrivateRepo if is private repo should proxy assets download.

func (*GithubConfig) RepoURL

func (c *GithubConfig) RepoURL() string

RepoURL returns repo URL on github.

type LatestYml added in v1.0.1

type LatestYml struct {
	Content            string `json:"content"`
	BrowserDownloadURL string `json:"URL"`
}

LatestYml stores asset update info of specific platform.

func (*LatestYml) ReplaceURL added in v1.0.1

func (yml *LatestYml) ReplaceURL(u string)

ReplaceURL replace the url in content with proxy url.

type ProxyDownloadConfig

type ProxyDownloadConfig struct {
	SaveDir string `yaml:"saveDir"`
	BaseURL string `yaml:"baseURL"`
}

ProxyDownloadConfig of proxy download files with current server.

type Release

type Release struct {
	Version   string            `json:"version"`
	Notes     string            `json:"notes"`
	PubDate   github.Timestamp  `json:"pubDate"`
	Platforms map[string]*Asset `json:"platforms"`
	RELEASES  string            `json:"RELEASES"`
}

Release contains major info of every release record.

type ReleaseData

type ReleaseData struct {
	Release       *Release `json:"release"`
	RepoURL       string   `json:"repoUrl"`
	ProxyDownload bool     `json:"proxyDownload"`
}

ReleaseData release info data for caching into file.

Jump to

Keyboard shortcuts

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