Documentation ¶
Index ¶
- Constants
- Variables
- func CalcProjectPath(projectName string) string
- func CalcProjectVersionPath(projectName string, projectVersion int) string
- func GetPublicUrl() string
- func HandleProjectExistsOnPublish(ctx context.Context, hubApi *HubApi, meta *HubMetaWrapper, ...) error
- func IsHubEnabled() bool
- func ValidateOrSelectLatestVersion(projectName string, versionFlag string, versions []int) (int, error)
- func ValidateOrSelectProject(projectFromFlag string, projectNames []string) (string, error)
- type HubApi
- func (h *HubApi) DeleteProject(projectName string) error
- func (h *HubApi) DeleteProjectVersion(projectName string, projectVersion int) error
- func (h *HubApi) DownloadProject(projectName string, version int, destFileName string) error
- func (h *HubApi) PublishProject(file io.Reader, ctx *ProjectContext) error
- func (h *HubApi) PublishProjectContentBySignedUrl(meta *ProjectMeta) (string, *ProjectFilePaths, error)
- func (h *HubApi) PublishProjectMeta(files *ProjectFilePaths, projectCtx *ProjectContext) error
- type HubMeta
- type HubMetaWrapper
- func (h *HubMetaWrapper) DeleteProject(projectName string) bool
- func (h *HubMetaWrapper) DeleteProjectVersion(projectName string, projectVersion int) bool
- func (h *HubMetaWrapper) GetProjectNames() []string
- func (h *HubMetaWrapper) GetProjectNamesByVersion(schemeVersion int) []string
- func (h *HubMetaWrapper) GetProjectVersions(projectName string) []int
- func (h *HubMetaWrapper) GetVersionMeta(projectName string, projectVersion int) (*HubProjectVersion, error)
- func (h *HubMetaWrapper) ProjectVersionExists(projectName string, projectVersion int) bool
- func (h *HubMetaWrapper) UpdateVersions(projectVersions []HubProjectVersion)
- type HubProject
- type HubProjectVersion
- type HubStorageApi
- func (hs *HubStorageApi) DeleteProject(projectName string) (bool, error)
- func (hs *HubStorageApi) DeleteProjectVersion(projectName string, projectVersion int) (bool, error)
- func (hs *HubStorageApi) DownloadProject(projectName string, projectVersion int, destFileName string) error
- func (hs *HubStorageApi) GetMeta() (*HubMeta, error)
- func (hs *HubStorageApi) GetMetaWrapper() (*HubMetaWrapper, error)
- func (hs *HubStorageApi) SetMeta(meta HubMeta) error
- func (hs *HubStorageApi) UpdateProjectMeta(filePaths *ProjectFilePaths, ctx *ProjectContext) (*HubProjectVersion, error)
- func (hs *HubStorageApi) UploadProjectContent(fileStream io.Reader, meta *ProjectMeta) (*ProjectFilePaths, error)
- func (hs *HubStorageApi) UploadProjectContentBySignedUrl(meta *ProjectMeta) (string, *ProjectFilePaths, error)
- type Image
- type ProjectContext
- type ProjectFilePaths
- type ProjectMeta
- type UploadCtx
Constants ¶
View Source
const ( PUBLIC_STORAGE_HUB_URL = "https://hub.tensorleap.ai" DEFAULT_NAMESPACE = "demo" NAMESPACE_META_FILE_NAME = "meta.yaml" PROJECT_META_FILE_NAME = "meta.json" PROJECT_TAR_FILE_SUFFIX_NAME = "project.tar" PROJECT_BG_IMAGE_FILE_NAME = "bgImage" GOOGLE_PROJECT_ID = "tensorleap-ops3" GOOGLE_BUCKET_NAME_PREFIX = "project-hub-" )
Variables ¶
View Source
var ErrProjectExists = fmt.Errorf("project already exists, use -o, --override to re-upload")
Functions ¶
func CalcProjectPath ¶
func CalcProjectVersionPath ¶
func GetPublicUrl ¶
func GetPublicUrl() string
func HandleProjectExistsOnPublish ¶
func HandleProjectExistsOnPublish(ctx context.Context, hubApi *HubApi, meta *HubMetaWrapper, projectMeta *ProjectMeta, override bool) error
func IsHubEnabled ¶
func IsHubEnabled() bool
Types ¶
type HubApi ¶
type HubApi struct {
// contains filtered or unexported fields
}
func NewHubApi ¶
func NewHubApi(hubStorage *HubStorageApi) *HubApi
func (*HubApi) DeleteProject ¶
func (*HubApi) DeleteProjectVersion ¶
func (*HubApi) DownloadProject ¶
func (*HubApi) PublishProject ¶
func (h *HubApi) PublishProject(file io.Reader, ctx *ProjectContext) error
func (*HubApi) PublishProjectContentBySignedUrl ¶
func (h *HubApi) PublishProjectContentBySignedUrl(meta *ProjectMeta) (string, *ProjectFilePaths, error)
func (*HubApi) PublishProjectMeta ¶
func (h *HubApi) PublishProjectMeta(files *ProjectFilePaths, projectCtx *ProjectContext) error
type HubMeta ¶
type HubMeta struct { Namespace string `json:"namespace" yaml:"namespace"` Projects map[string]HubProject `json:"projects" yaml:"projects"` }
func UnmarshalHubMeta ¶
type HubMetaWrapper ¶
type HubMetaWrapper struct {
Data HubMeta `json:"data" yaml:"data"`
}
func CreateWrapperMetaFromUrl ¶
func CreateWrapperMetaFromUrl(url string) (*HubMetaWrapper, error)
func NewHubMetaWrapper ¶
func NewHubMetaWrapper(hubMeta HubMeta) *HubMetaWrapper
func (*HubMetaWrapper) DeleteProject ¶
func (h *HubMetaWrapper) DeleteProject(projectName string) bool
func (*HubMetaWrapper) DeleteProjectVersion ¶
func (h *HubMetaWrapper) DeleteProjectVersion(projectName string, projectVersion int) bool
func (*HubMetaWrapper) GetProjectNames ¶
func (h *HubMetaWrapper) GetProjectNames() []string
func (*HubMetaWrapper) GetProjectNamesByVersion ¶
func (h *HubMetaWrapper) GetProjectNamesByVersion(schemeVersion int) []string
func (*HubMetaWrapper) GetProjectVersions ¶
func (h *HubMetaWrapper) GetProjectVersions(projectName string) []int
func (*HubMetaWrapper) GetVersionMeta ¶
func (h *HubMetaWrapper) GetVersionMeta(projectName string, projectVersion int) (*HubProjectVersion, error)
func (*HubMetaWrapper) ProjectVersionExists ¶
func (h *HubMetaWrapper) ProjectVersionExists(projectName string, projectVersion int) bool
func (*HubMetaWrapper) UpdateVersions ¶
func (h *HubMetaWrapper) UpdateVersions(projectVersions []HubProjectVersion)
type HubProject ¶
type HubProject struct { CreatedAt int64 `json:"createdAt" yaml:"createdAt"` Versions map[string]HubProjectVersion `json:"versions" yaml:"versions"` }
type HubProjectVersion ¶
type HubProjectVersion struct { ProjectMeta `yaml:",inline"` CreatedAt int64 `json:"createdAt" yaml:"createdAt"` Path string `json:"path" yaml:"path"` Size int `json:"size" yaml:"size"` // bytes }
type HubStorageApi ¶
type HubStorageApi struct { Namespace string FilesClient storage.StorageClient }
func NewHubStorageApi ¶
func NewHubStorageApi(namespace string, filesClient storage.StorageClient) *HubStorageApi
func (*HubStorageApi) DeleteProject ¶
func (hs *HubStorageApi) DeleteProject(projectName string) (bool, error)
func (*HubStorageApi) DeleteProjectVersion ¶
func (hs *HubStorageApi) DeleteProjectVersion(projectName string, projectVersion int) (bool, error)
func (*HubStorageApi) DownloadProject ¶
func (hs *HubStorageApi) DownloadProject(projectName string, projectVersion int, destFileName string) error
func (*HubStorageApi) GetMeta ¶
func (hs *HubStorageApi) GetMeta() (*HubMeta, error)
func (*HubStorageApi) GetMetaWrapper ¶
func (hs *HubStorageApi) GetMetaWrapper() (*HubMetaWrapper, error)
func (*HubStorageApi) SetMeta ¶
func (hs *HubStorageApi) SetMeta(meta HubMeta) error
func (*HubStorageApi) UpdateProjectMeta ¶
func (hs *HubStorageApi) UpdateProjectMeta(filePaths *ProjectFilePaths, ctx *ProjectContext) (*HubProjectVersion, error)
func (*HubStorageApi) UploadProjectContent ¶
func (hs *HubStorageApi) UploadProjectContent(fileStream io.Reader, meta *ProjectMeta) (*ProjectFilePaths, error)
func (*HubStorageApi) UploadProjectContentBySignedUrl ¶
func (hs *HubStorageApi) UploadProjectContentBySignedUrl(meta *ProjectMeta) (string, *ProjectFilePaths, error)
type ProjectContext ¶
type ProjectContext struct { Meta ProjectMeta BgImage Image }
func ExtractProjectContextFromTar ¶
func ExtractProjectContextFromTar(tarStream io.Reader) (*ProjectContext, error)
type ProjectFilePaths ¶
func GenerateProjectFilePaths ¶
func GenerateProjectFilePaths(namespace string, meta *ProjectMeta) *ProjectFilePaths
type ProjectMeta ¶
type ProjectMeta struct { Name string `json:"name" yaml:"name"` Description string `json:"description,omitempty" yaml:"description,omitempty"` Tags []string `json:"tags" yaml:"tags"` Categories map[string]interface{} `json:"categories" yaml:"categories"` BgImagePath string `json:"bgImagePath" yaml:"bgImagePath"` SchemaVersion int `json:"schemaVersion" yaml:"schemaVersion"` SourceProjectId string `json:"sourceProjectId" yaml:"sourceProjectId"` }
type UploadCtx ¶
type UploadCtx struct { Meta ProjectMeta Files ProjectFilePaths }
Click to show internal directories.
Click to hide internal directories.