Documentation
¶
Index ¶
- func BuiltinConfigNames() []string
- func BuiltinMirrorNames() []string
- func DefaultStorePath() (string, error)
- func RenderTemplate(pattern string, vars TemplateVars) (string, error)
- type BuiltinConfig
- type BuiltinConfigSource
- type CachedIndexInfo
- type Config
- type DownloadRequest
- type DownloadResult
- type DownloaderFunc
- type HTMLParseOptions
- type Index
- type IndexCache
- func (c IndexCache) Clear(name string) error
- func (c IndexCache) ClearAll() error
- func (c IndexCache) ClearForSource(name, sourceURL string) error
- func (c IndexCache) List() ([]CachedIndexInfo, error)
- func (c IndexCache) Load(name string) (Index, error)
- func (c IndexCache) LoadForSource(name, sourceURL string) (Index, error)
- func (c IndexCache) Path(name string) string
- func (c IndexCache) PathForSource(name, sourceURL string) string
- func (c IndexCache) Save(index Index) error
- type IndexFile
- type IndexItem
- type IndexRefreshEvent
- type IndexRefreshStage
- type InstallOptions
- type InstallResult
- type InstalledEntry
- type InstalledSDKNode
- type InstalledStore
- type JSONParseOptions
- type RemoveResult
- type ResolveConfigOptions
- type SearchOptions
- type SearchResult
- type Service
- func (s Service) ClearAllIndexes() error
- func (s Service) ClearIndex(name string) error
- func (s Service) Install(ctx context.Context, rawTarget string, opts InstallOptions) (InstallResult, error)
- func (s Service) InstallMany(ctx context.Context, targets []string, opts InstallOptions) ([]InstallResult, error)
- func (s Service) List(name string) ([]InstalledEntry, error)
- func (s Service) ListIndexes() ([]CachedIndexInfo, error)
- func (s Service) RefreshAllIndexes(ctx context.Context) ([]Index, error)
- func (s Service) RefreshIndex(ctx context.Context, name string) (Index, error)
- func (s Service) Remove(rawTarget string) (RemoveResult, error)
- func (s Service) SearchIndex(name string, opts SearchOptions) ([]SearchResult, error)
- func (s Service) ShowIndex(name string) (Index, error)
- type Store
- type Target
- type TemplateVars
- type VersionKind
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuiltinConfigNames ¶
func BuiltinConfigNames() []string
func BuiltinMirrorNames ¶
func BuiltinMirrorNames() []string
func DefaultStorePath ¶
func RenderTemplate ¶
func RenderTemplate(pattern string, vars TemplateVars) (string, error)
Types ¶
type BuiltinConfig ¶
type BuiltinConfig struct {
Name string
Aliases []string
Source BuiltinConfigSource
Section cfgpkg.SDKSection
}
func BuiltinConfigs ¶
func BuiltinConfigs(source BuiltinConfigSource) []BuiltinConfig
func FindBuiltinConfig ¶
func FindBuiltinConfig(name string, source BuiltinConfigSource) (BuiltinConfig, bool)
type BuiltinConfigSource ¶
type BuiltinConfigSource string
const ( BuiltinConfigOfficial BuiltinConfigSource = "official" BuiltinConfigMirror BuiltinConfigSource = "mirror" BuiltinConfigAliyun BuiltinConfigSource = "aliyun" BuiltinConfigHuawei BuiltinConfigSource = "huawei" BuiltinConfigZulu BuiltinConfigSource = "zulu" )
type CachedIndexInfo ¶
type Config ¶
type Config struct {
Name string
Aliases []string
SDKTarget string
TargetTemplate string
URLTemplate string
IndexURL string
IndexFormat string
IndexParser string
IndexPathPrefix string
FilenamePattern string
StripComponents int
OS string
Arch string
Ext string
OSMap map[string]string
ArchMap map[string]string
ExtMap map[string]string
}
func ResolveConfig ¶
type DownloadRequest ¶
type DownloadResult ¶
type DownloadResult struct {
Path string
FromCache bool
Resumed bool
Size int64
ETag string
Modified string
}
func DownloadArchive ¶
func DownloadArchive(ctx context.Context, req DownloadRequest) (DownloadResult, error)
type DownloaderFunc ¶
type DownloaderFunc func(context.Context, DownloadRequest) (DownloadResult, error)
type HTMLParseOptions ¶
type Index ¶
type Index struct {
Schema int `json:"schema"`
SDK string `json:"sdk"`
SourceURL string `json:"source_url"`
FetchedAt time.Time `json:"fetched_at"`
Items []IndexItem `json:"items"`
}
func ParseHTMLIndex ¶
func ParseHTMLIndex(body io.Reader, opts HTMLParseOptions) (Index, error)
func ParseJSONIndex ¶
type IndexCache ¶
type IndexCache struct {
Dir string
}
func (IndexCache) Clear ¶
func (c IndexCache) Clear(name string) error
func (IndexCache) ClearAll ¶
func (c IndexCache) ClearAll() error
func (IndexCache) ClearForSource ¶
func (c IndexCache) ClearForSource(name, sourceURL string) error
func (IndexCache) List ¶
func (c IndexCache) List() ([]CachedIndexInfo, error)
func (IndexCache) LoadForSource ¶
func (c IndexCache) LoadForSource(name, sourceURL string) (Index, error)
func (IndexCache) Path ¶
func (c IndexCache) Path(name string) string
func (IndexCache) PathForSource ¶
func (c IndexCache) PathForSource(name, sourceURL string) string
func (IndexCache) Save ¶
func (c IndexCache) Save(index Index) error
type IndexFile ¶
type IndexItem ¶
type IndexRefreshEvent ¶
type IndexRefreshStage ¶
type IndexRefreshStage string
const ( IndexRefreshFetchStart IndexRefreshStage = "fetch_start" IndexRefreshFetchDone IndexRefreshStage = "fetch_done" IndexRefreshParseStart IndexRefreshStage = "parse_start" IndexRefreshParseDone IndexRefreshStage = "parse_done" IndexRefreshParseFailed IndexRefreshStage = "parse_failed" IndexRefreshCacheHit IndexRefreshStage = "cache_hit" )
type InstallOptions ¶
type InstallResult ¶
type InstalledEntry ¶
type InstalledEntry struct {
Name string `json:"name"`
Version string `json:"version"`
Path string `json:"path"`
URL string `json:"url"`
Filename string `json:"filename"`
OS string `json:"os"`
Arch string `json:"arch"`
Ext string `json:"ext"`
InstalledAt time.Time `json:"installed_at"`
StripComponents int `json:"strip_components"`
}
type InstalledSDKNode ¶
type InstalledSDKNode struct {
Versions map[string]InstalledEntry `json:"versions"`
}
type InstalledStore ¶
type InstalledStore struct {
Schema int `json:"schema"`
Installed map[string]InstalledSDKNode `json:"installed"`
}
type JSONParseOptions ¶
type RemoveResult ¶
type ResolveConfigOptions ¶
type SearchOptions ¶
type SearchResult ¶
type Service ¶
type Service struct {
Config *cfgpkg.File
Store Store
IndexCache IndexCache
ClientOpts client.Options
GOOS string
GOARCH string
Now func() time.Time
Downloader DownloaderFunc
OnIndexRefresh func(IndexRefreshEvent)
}
func (Service) ClearAllIndexes ¶
func (Service) ClearIndex ¶
func (Service) Install ¶
func (s Service) Install(ctx context.Context, rawTarget string, opts InstallOptions) (InstallResult, error)
func (Service) InstallMany ¶
func (s Service) InstallMany(ctx context.Context, targets []string, opts InstallOptions) ([]InstallResult, error)
func (Service) ListIndexes ¶
func (s Service) ListIndexes() ([]CachedIndexInfo, error)
func (Service) RefreshAllIndexes ¶
func (Service) RefreshIndex ¶
func (Service) SearchIndex ¶
func (s Service) SearchIndex(name string, opts SearchOptions) ([]SearchResult, error)
type Store ¶
type Store struct {
Path string
}
func (Store) Load ¶
func (s Store) Load() (InstalledStore, error)
func (Store) Record ¶
func (s Store) Record(entry InstalledEntry) error
func (Store) Save ¶
func (s Store) Save(store InstalledStore) error
type Target ¶
type Target struct {
Raw string
Name string
Version string
Kind VersionKind
}
func ParseTarget ¶
type TemplateVars ¶
type VersionKind ¶
type VersionKind string
const ( VersionLatest VersionKind = "latest" VersionExact VersionKind = "exact" VersionPrefix VersionKind = "prefix" )
Click to show internal directories.
Click to hide internal directories.