storage

package
v1.4.1-rc1 Latest Latest
Warning

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

Go to latest
Published: May 8, 2019 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const CurrentStorageKey = "current"

CurrentStorageKey is used as GlobalStorage key for the current package

Variables

This section is empty.

Functions

func GetLatestReleaseDate

func GetLatestReleaseDate(ctx context.Context, ghClient *github.Client, repo string) (string, error)

GetLatestReleaseDate returns the date for the latest OpenGApps release

Types

type GlobalStorage

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

GlobalStorage stores all the available storages

func NewGlobalStorage

func NewGlobalStorage(cache *db.DB) *GlobalStorage

NewGlobalStorage creates a new GlobalStorage instance

func (*GlobalStorage) Add

func (gs *GlobalStorage) Add(date string, s *Storage)

Add safely adds a new Storage to the storages

func (*GlobalStorage) AddLatestStorage

func (gs *GlobalStorage) AddLatestStorage(ctx context.Context, ghClient *github.Client, dq *net.DownloadQueue, cfg *viper.Viper) error

AddLatestStorage adds the latest Storage to the storages

func (*GlobalStorage) Get

func (gs *GlobalStorage) Get(date string) (*Storage, bool)

Get safely gets a Storage from the storages

func (*GlobalStorage) Load

func (gs *GlobalStorage) Load() error

Load loads the GlobalStorage from the cache

func (*GlobalStorage) Save

func (gs *GlobalStorage) Save()

Save saves the GlobalStorage to the cache

type Package

type Package struct {
	Name      string         `json:"name"`
	Date      string         `json:"date"`
	OriginURL string         `json:"origin_url"`
	LocalURL  string         `json:"local_url"`
	RemoteURL string         `json:"remote_url"`
	MD5       string         `json:"md5"`
	Size      int            `json:"size"`
	Platform  gapps.Platform `json:"platform"`
	Android   gapps.Android  `json:"android"`
	Variant   gapps.Variant  `json:"variant"`
}

Package describes the OpenGApps package

func (*Package) CreateMirror

func (p *Package) CreateMirror(dq *net.DownloadQueue, cfg *viper.Viper) error

CreateMirror creates a new mirror for the package

type Storage

type Storage struct {
	Date     string                                                          `json:"date"`
	Count    int                                                             `json:"count"`
	Packages map[gapps.Platform]map[gapps.Android]map[gapps.Variant]*Package `json:"packages"`
	// contains filtered or unexported fields
}

Storage describes a package storage

func GetPackageStorage

func GetPackageStorage(ctx context.Context, ghClient *github.Client, dq *net.DownloadQueue, cfg *viper.Viper, releaseTag string) (*Storage, error)

GetPackageStorage creates and fills a new Storage

func (*Storage) Add

func (s *Storage) Add(p *Package)

Add safely adds a new package to the Storage

func (*Storage) Delete

func (s *Storage) Delete(p *Package)

Delete safely deletes a package from the Storage (if it's there)

func (*Storage) Get

func (s *Storage) Get(p gapps.Platform, a gapps.Android, v gapps.Variant) (*Package, bool)

Get safely gets a package from the Storage

func (*Storage) Save

func (s *Storage) Save() error

Save saves the Storage to the cache

Jump to

Keyboard shortcuts

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