prefabservice

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2025 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusReady       = 0
	StatusDownloading = 1
	StatusError       = 2
)

Variables

This section is empty.

Functions

func PostSpecSheet

func PostSpecSheet(baseURL string, specSheet repointerface.SpecSheet) (prefabID string, blueprintID string, err error)

func UploadPrefabBlueprint

func UploadPrefabBlueprint(baseURL string, repository string, prefabPath string, blueprintPath string) error

Types

type FileInfo

type FileInfo struct {
	Filename string `json:"filename"`
	ID       string `json:"id"`
	Status   int    `json:"status"`
}

type FileStore

type FileStore struct {
	Files map[string]*FileInfo `json:"files"`

	sync.RWMutex
	// contains filtered or unexported fields
}

func NewFileStore

func NewFileStore(workDir string) (fileStore *FileStore, err error)

func (*FileStore) AddFile

func (f *FileStore) AddFile(file io.ReadCloser, filename string, id string, targetDir string) (err error)

When targetDir is empty string, the fetched file is not unpacked When targetDir is "/" or other paths, the fetched file is unpacked

func (*FileStore) DeleteFile

func (f *FileStore) DeleteFile(id string) (err error)

func (*FileStore) GetPath

func (f *FileStore) GetPath(id string) (path string, filename string, err error)

func (*FileStore) NewFile

func (f *FileStore) NewFile(path string) (id string, err error)

func (*FileStore) WaitDownload

func (f *FileStore) WaitDownload(ids []string) (err error)

type InfoStore

type InfoStore struct {
	Repos map[string]*RepoInfo `json:"repos"`

	sync.RWMutex
	// contains filtered or unexported fields
}

func NewInfoStore

func NewInfoStore(workDir string, ttl time.Duration) (infoStore *InfoStore, err error)

func (*InfoStore) DeleteItem

func (i *InfoStore) DeleteItem(repo string, name string, version string, environment string) (err error)

func (*InfoStore) GetEnvironments

func (i *InfoStore) GetEnvironments(repo string, name string, version string) (environments []string, outdated bool)

func (*InfoStore) GetItem

func (i *InfoStore) GetItem(repo string, name string, version string, environment string) (prefabID, blueprintID string)

func (*InfoStore) GetNameAll

func (i *InfoStore) GetNameAll(repo string, name string) (nameInfo *NameInfo, outdated bool)

func (*InfoStore) GetNames

func (i *InfoStore) GetNames(repo string) (names []string, outdated bool)

func (*InfoStore) GetVersions

func (i *InfoStore) GetVersions(repo string, name string) (versions []string, outdated bool)

func (*InfoStore) SetEnvironments

func (i *InfoStore) SetEnvironments(repo string, name string, version string, environments []string) (err error)

func (*InfoStore) SetItem

func (i *InfoStore) SetItem(repo string, name string, version string, environment string, prefabID string, blueprintID string) (err error)

func (*InfoStore) SetNameAll

func (i *InfoStore) SetNameAll(repo string, name string, nameInfo NameInfo) (err error)

func (*InfoStore) SetNames

func (i *InfoStore) SetNames(repo string, names []string) (err error)

func (*InfoStore) SetVersions

func (i *InfoStore) SetVersions(repo string, name string, versions []string) (err error)

type ItemInfo

type ItemInfo struct {
	PrefabID    string `json:"prefab"`
	BlueprintID string `json:"blueprint"`
}

type NameInfo

type NameInfo struct {
	Versions   map[string]*VersionInfo `json:"versions"`
	UpdateTime time.Time               `json:"update"`
}

type PrefabService

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

func NewPrefabService

func NewPrefabService(workDir string, upstream string, fabricatePrefab bool, unpackPrefab bool, logging bool, ttl time.Duration) (ps *PrefabService, err error)

func NewProxyService

func NewProxyService(workDir string, upstream string) (ps *PrefabService, err error)

func NewServerService

func NewServerService(workDir string) (ps *PrefabService, err error)

func NewUserService

func NewUserService(workDir string, upstream string) (ps *PrefabService, err error)

func (*PrefabService) Fabricate

func (ps *PrefabService) Fabricate(specSheet repointerface.SpecSheet, dstDir string) (prefabPath string, blueprintPath string, err error)

func (*PrefabService) FabricateDepend

func (ps *PrefabService) FabricateDepend(item *prefab.Prefab, existVersions []string, dstDir string) (prefabPaths []string, blueprintPaths []string, err error)

func (*PrefabService) GenerateSpecSheet

func (p *PrefabService) GenerateSpecSheet(name string, specifier string) (specSheet repointerface.SpecSheet, err error)

func (*PrefabService) GetEnvs

func (ps *PrefabService) GetEnvs(specSheet repointerface.SpecSheet) (envs []string, err error)

func (*PrefabService) GetUpstreamEnvironemnts

func (ps *PrefabService) GetUpstreamEnvironemnts(repository string, name string, version string) (environments []string, err error)

func (*PrefabService) GetUpstreamFile

func (ps *PrefabService) GetUpstreamFile(id string) (file io.ReadCloser, filename string, err error)

func (*PrefabService) GetUpstreamItem

func (ps *PrefabService) GetUpstreamItem(repository string, name string, version string, environment string) (prefabID string, blueprintID string, err error)

func (*PrefabService) GetUpstreamNames

func (ps *PrefabService) GetUpstreamNames(repository string) (names []string, err error)

func (*PrefabService) GetUpstreamVersions

func (ps *PrefabService) GetUpstreamVersions(repository string, name string) (versions []string, err error)

func (*PrefabService) GetVersions

func (ps *PrefabService) GetVersions(specSheet repointerface.SpecSheet) (versions []string, err error)

func (*PrefabService) HandleDeleteItem

func (ps *PrefabService) HandleDeleteItem(repository string, name string, version string, environment string) (err error)

func (*PrefabService) HandleGetEnvironments

func (ps *PrefabService) HandleGetEnvironments(repository string, name string, version string) (environments []string, err error)

func (*PrefabService) HandleGetFile

func (ps *PrefabService) HandleGetFile(id string) (path string, filename string, err error)

func (*PrefabService) HandleGetItem

func (ps *PrefabService) HandleGetItem(repository string, name string, version string, environment string) (prefabID string, blueprintID string, err error)

func (*PrefabService) HandleGetNames

func (ps *PrefabService) HandleGetNames(repository string) (names []string, err error)

func (*PrefabService) HandleGetVersions

func (ps *PrefabService) HandleGetVersions(repository string, name string) (versions []string, err error)

func (*PrefabService) HandleList

func (p *PrefabService) HandleList(writer io.Writer) (err error)

func (*PrefabService) HandlePostSpecSheet

func (ps *PrefabService) HandlePostSpecSheet(specSheet []byte) (prefabID string, blueprintID string, err error)

func (*PrefabService) HandlePostUpload

func (ps *PrefabService) HandlePostUpload(repository string, prefabPath string, blueprintPath string) (prefabID string, blueprintID string, err error)

func (*PrefabService) Init

func (p *PrefabService) Init(ctx *dcontext.DeployContext) (err error)

func (*PrefabService) PostUpstreamSpecSheet

func (ps *PrefabService) PostUpstreamSpecSheet(specSheet repointerface.SpecSheet) (prefabID string, blueprintID string, err error)

func (*PrefabService) PrefabSelection

func (ps *PrefabService) PrefabSelection(specSheet repointerface.SpecSheet) (prefabID string, blueprintID string, err error)

func (*PrefabService) RequestBlueprint

func (ps *PrefabService) RequestBlueprint(prefabReq *prefab.Prefab, ctx *dcontext.DeployContext) (blueprint prefab.Blueprint, err error)

func (*PrefabService) RequestPrefabBlueprint

func (ps *PrefabService) RequestPrefabBlueprint(prefabReq *prefab.Prefab, ctx *dcontext.DeployContext) (prefabPath string, prefabID string, blueprint prefab.Blueprint, err error)

func (*PrefabService) WaitDownload

func (ps *PrefabService) WaitDownload(ids []string) error

type RepoInfo

type RepoInfo struct {
	Names      map[string]*NameInfo `json:"names"`
	UpdateTime time.Time            `json:"update"`
}

type SpecSheet

type SpecSheet struct {
	SpecType        string `json:"specType"`
	Name_s          string `json:"name"`
	Version_s       string `json:"version"`
	Environment_s   string `json:"environment"`
	RequiredVersion string `json:"requiredVersion"`
	RequiredEnv     string `json:"requiredEnv"`
}

func (*SpecSheet) Environment

func (s *SpecSheet) Environment() string

func (*SpecSheet) Name

func (s *SpecSheet) Name() string

func (*SpecSheet) SelectEnv

func (s *SpecSheet) SelectEnv(envs []string) (err error)

func (*SpecSheet) SelectVersion

func (s *SpecSheet) SelectVersion(versions []string) (err error)

func (*SpecSheet) Type

func (s *SpecSheet) Type() string

func (*SpecSheet) Version

func (s *SpecSheet) Version() string

func (*SpecSheet) VersionSpecifier

func (s *SpecSheet) VersionSpecifier() string

type VersionInfo

type VersionInfo struct {
	Environments map[string]*ItemInfo `json:"environments"`
	UpdateTime   time.Time            `json:"update"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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