Documentation ¶
Index ¶
- func InitDB(conn string, driver string, name string) error
- func QueryReposList() ([]string, error)
- func QueryTagsList(reponame string, proto string, protoVerion string) ([]string, error)
- type ContainerImage
- type ContainerRepo
- type Pkg
- func AddPkg(reponame string, name string, size int64, pkgType string) (*Pkg, error)
- func PkgDownloadInc(reponame string, name string) (*Pkg, error)
- func QueryPkgByID(repoid int64, name string) (*Pkg, error)
- func QueryPkgByName(repoName string, name string) (*Pkg, error)
- func QueryPkgListByRepoName(reponame string) ([]Pkg, error)
- type PkgInfo
- type PkgRepo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ContainerImage ¶
type ContainerImage struct { ID int `orm:"column(id);auto"` Tag string `orm:"column(tag);size(255);null"` Size int64 `orm:"column(size);null"` RepoID int `orm:"column(repo_id);null"` // docker, oci, rkt... Proto string `orm:"column(proto);size(15);null"` ProtoVersion string `orm:"column(proto_version);size(15);null"` }
ContainerImage defines the container image struct.
func AddImage ¶
func AddImage(reponame string, tags string, proto string, protoVerion string) (*ContainerImage, error)
AddImage adds an image to the database. If the target repo is not exist, it will create a repo. TODO: lots of rollback
func QueryImage ¶
QueryImage returns a container image by 'repoid, tag, proto and proto version'
type ContainerRepo ¶
type ContainerRepo struct { ID int `orm:"column(id);auto"` Name string `orm:"unique;column(name);size(255);null"` Star int `orm:"column(star);null"` DownloadNum int `orm:"column(download_num);null"` Description string `orm:"column(description);null"` }
ContainerRepo defines the container repo struct, will support dockerv2, ociv1.
func AddRepo ¶
func AddRepo(reponame string) (*ContainerRepo, error)
AddRepo adds a repo to the database
type Pkg ¶
type Pkg struct { ID int64 `orm:"column(id);auto"` // Name is not unique Name string `orm:"column(name);size(255);null"` Size int64 `orm:"column(size);null"` RepoID int64 `orm:"column(repo_id);null"` Downloads int64 `orm:"column(downloads);null"` // rpm, iso, ... Type string `orm:"column(type);size(15);null"` }
Pkg defines the pkg pkg struct.
func AddPkg ¶
AddPkg adds a package to the database. If the target repo is not exist, it will create a repo. TODO: lots of rollback
func PkgDownloadInc ¶
PkgDownloadInc increases the download count by one TODO: lock/unlock the db item TODO: add a detailed pkg download info, like ip, date?
func QueryPkgByID ¶
QueryPkgByID returns a package by 'repoid, name'
func QueryPkgByName ¶
QueryPkgByName returns a package by 'repoName, name'
func QueryPkgListByRepoName ¶
QueryPkgListByRepoName returns the package list by 'reponame'
type PkgRepo ¶
type PkgRepo struct { ID int64 `orm:"column(id);auto"` // More like a directory here Name string `orm:"unique;column(name);size(255);null"` Star int64 `orm:"column(star);null"` Description string `orm:"column(description);null"` }
PkgRepo defines the meta data of a package repository. For example, the create data, the star counts and the etc..
func AddPkgRepo ¶
AddPkgRepo adds a repo to the database