storage

package
v0.0.0-...-8b5d6f4 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2019 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const SOURCE_TYPE_FILE = "file"
View Source
const SOURCE_TYPE_GIT = "git"

Variables

This section is empty.

Functions

func AddKeyToApp

func AddKeyToApp(app *App, key *Key) error

func InitDataDir

func InitDataDir() error

func InitInstallDir

func InitInstallDir() error

func InstallApp

func InstallApp(app *App, version *version.Version) error

func IsLocked

func IsLocked() bool

func Lock

func Lock() error

func RemoveKeyFromApp

func RemoveKeyFromApp(app *App, key *Key) error

func UninstallApp

func UninstallApp(app *App) error

func Unlock

func Unlock() error

Types

type App

type App struct {
	Label      string          `json:"label, omitempty"`
	Name       string          `json:"name, omitempty"`
	Path       string          `json:"path, omitempty"`
	URL        string          `json:"url, omitempty"`
	Email      string          `json:"email, omitempty"`
	Latest     string          `json:"latest, omitempty"`
	Source     ISource         `json:"source, omitempty"`
	Candidates []*AppCandidate `json:"candidates, omitempty"`

	ClientID     string `json:"clientID, omitempty"`
	ClientSecret string `json:"clientSecret, omitempty"`
	Keys         []*Key `json:"keys, omitempty"`
	// contains filtered or unexported fields
}

func NewApp

func NewApp() *App

func (*App) BuildHash

func (app *App) BuildHash()

func (*App) GetCandidate

func (app *App) GetCandidate(version *version.Version) *AppCandidate

func (*App) GetHash

func (app *App) GetHash() string

func (*App) UnmarshalJSON

func (app *App) UnmarshalJSON(data []byte) error

type AppCandidate

type AppCandidate struct {
	Version      *version.Version `json:"version"`
	Dependencies []*AppDependency `json:"dependencies"`
	Files        []string         `json:"files"`
}

func NewAppCandidate

func NewAppCandidate() *AppCandidate

func (*AppCandidate) GetFilesDir

func (appCandidate *AppCandidate) GetFilesDir() string

type AppDependency

type AppDependency struct {
	Label   string           `json:"label"`
	Version *version.Version `json:"version"`
}

func NewAppDependency

func NewAppDependency() *AppDependency

type AppList

type AppList struct {
	Apps   []*App           `json:"data,omitempty"`
	Labels map[string][]int `json:"-"`
}

func (*AppList) AddApp

func (appList *AppList) AddApp(app *App) error

func (*AppList) AppIndex

func (appList *AppList) AppIndex(app *App) int

func (*AppList) BuildAppHashes

func (appList *AppList) BuildAppHashes()

func (*AppList) BuildLabels

func (appList *AppList) BuildLabels()

func (*AppList) Clear

func (appList *AppList) Clear()

func (*AppList) RemoveApp

func (appList *AppList) RemoveApp(app *App) error

func (*AppList) Save

func (appList *AppList) Save() error

func (*AppList) Search

func (appList *AppList) Search(text string, exact bool) []*App

type FileSource

type FileSource struct {
	Source
}

func NewFileSource

func NewFileSource(url string) *FileSource

func (*FileSource) BuildHash

func (fileSource *FileSource) BuildHash()

func (*FileSource) Cleanup

func (fileSource *FileSource) Cleanup()

func (*FileSource) GetAbsolutePath

func (fileSource *FileSource) GetAbsolutePath() string

func (*FileSource) GetHash

func (fileSource *FileSource) GetHash() string

func (*FileSource) GetType

func (fileSource *FileSource) GetType() string

func (*FileSource) MarshalJSON

func (fileSource *FileSource) MarshalJSON() ([]byte, error)

func (*FileSource) String

func (fileSource *FileSource) String() string

func (*FileSource) UnmarshalJSON

func (fileSource *FileSource) UnmarshalJSON(data []byte) error

func (*FileSource) Update

func (fileSource *FileSource) Update() error

type GitSource

type GitSource struct {
	Source
}

func NewGitSource

func NewGitSource(url string) *GitSource

func (*GitSource) BuildHash

func (gitSource *GitSource) BuildHash()

func (*GitSource) Cleanup

func (gitSource *GitSource) Cleanup()

func (*GitSource) GetAbsolutePath

func (gitSource *GitSource) GetAbsolutePath() string

func (*GitSource) GetHash

func (gitSource *GitSource) GetHash() string

func (*GitSource) GetType

func (gitSource *GitSource) GetType() string

func (*GitSource) MarshalJSON

func (gitSource *GitSource) MarshalJSON() ([]byte, error)

func (*GitSource) String

func (gitSource *GitSource) String() string

func (*GitSource) UnmarshalJSON

func (gitSource *GitSource) UnmarshalJSON(data []byte) error

func (*GitSource) Update

func (gitSource *GitSource) Update() error

type ISource

type ISource interface {
	GetType() string
	Update() error
	Cleanup()
	String() string
	GetAbsolutePath() string
	GetHash() string
	BuildHash()
}

func SourceFromString

func SourceFromString(sourceString string) ISource

type InstalledAppsIndex

type InstalledAppsIndex struct {
	AppList
}

func NewInstalledAppsIndex

func NewInstalledAppsIndex() (*InstalledAppsIndex, error)

func (*InstalledAppsIndex) Build

func (installedAppsIndex *InstalledAppsIndex) Build() error

func (*InstalledAppsIndex) Load

func (installedAppsIndex *InstalledAppsIndex) Load() error

func (*InstalledAppsIndex) Save

func (installedAppsIndex *InstalledAppsIndex) Save() error

type Key

type Key struct {
	Label  string   `json:"label"`
	Data   string   `json:"data"`
	Groups []string `json:"groups"`
}

func NewKeyFromText

func NewKeyFromText(text string) *Key

kapi_id="003";kapi_key="f0b8bb52f4c7007938757bcdfc73b452d6ce08cc0c660ce57c5464ae95f35417";kapi_groups="stats,watcher,spender,admin";eval ugroups_${kapi_id}=${kapi_groups};eval ukey_${kapi_id}=${kapi_key}

type KeyList

type KeyList struct {
	Keys   []*Key         `json:"data,omitempty"`
	Labels map[string]int `json:"-"`
}

func NewKeyList

func NewKeyList() *KeyList

func (*KeyList) AddKey

func (keyList *KeyList) AddKey(key *Key) error

func (*KeyList) BuildLabels

func (keyList *KeyList) BuildLabels()

func (*KeyList) GetKey

func (keyList *KeyList) GetKey(label string) *Key

func (*KeyList) HasKey

func (keyList *KeyList) HasKey(label string) bool

func (*KeyList) KeyIndex

func (keyList *KeyList) KeyIndex(key *Key) int

func (*KeyList) Load

func (keyList *KeyList) Load() error

func (*KeyList) RemoveKey

func (keyList *KeyList) RemoveKey(key *Key) error

type RepoIndex

type RepoIndex struct {
	AppList
}

func NewRepoIndex

func NewRepoIndex() (*RepoIndex, error)

func (*RepoIndex) Build

func (repoIndex *RepoIndex) Build() error

func (*RepoIndex) Load

func (repoIndex *RepoIndex) Load() error

func (*RepoIndex) Save

func (repoIndex *RepoIndex) Save() error

type Source

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

type SourceList

type SourceList struct {
	Path    string
	Sources []ISource
}

func LoadSourceFile

func LoadSourceFile(path string) (*SourceList, error)

func NewSourceList

func NewSourceList(path string) *SourceList

func (*SourceList) AddSource

func (sourceList *SourceList) AddSource(sourceString string) error

func (*SourceList) RemoveSource

func (sourceList *SourceList) RemoveSource(sourceString string) error

func (*SourceList) Save

func (sourceList *SourceList) Save() error

func (*SourceList) SourceIndex

func (sourceList *SourceList) SourceIndex(sourceString string) int

type State

type State struct {
	Version       string    `json:"version"`
	LastUpdate    time.Time `json:"lastUpdate"`
	Apps          *AppList  `json:"apps"`
	InstalledApps *AppList  `json:"installedApps"`
}

type StateFile

type StateFile struct {
	Path  string
	State *State
}

func LoadStateFile

func LoadStateFile(path string) (*StateFile, error)

func NewStateFile

func NewStateFile(path string) *StateFile

func (*StateFile) Save

func (stateFile *StateFile) Save() error

Jump to

Keyboard shortcuts

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