Documentation ¶
Index ¶
- Variables
- func AddDownloader(remoteAddr string) error
- func BlockPackage(importPath, note string) (keys []string, err error)
- func DeleteBlockRule(id int64) error
- func DeleteRevisionById(revId int64) error
- func IncreasePackageDownloadCount(importPath string) error
- func IsPackageBlocked(path string) (bool, error, error)
- func NewBlockRule(r *BlockRule) error
- func Ping() error
- func RunBlockRule(id int64) (count int64, keys []string, err error)
- func UnblockPackage(id int64) error
- func UpdateRevision(rev *Revision) error
- type Block
- type BlockError
- type BlockRule
- type DownloadStats
- type Downloader
- type Package
- type Revision
- type Stats
- type Storage
Constants ¶
This section is empty.
Variables ¶
var ( ErrRevisionIsLocal = errors.New("revision archive is in local") ErrPackageNotExist = errors.New("package does not exist") ErrRevisionNotExist = errors.New("revision does not exist") )
var (
ErrBlockRuleNotExist = errors.New("Block rule does not exist")
)
Functions ¶
func AddDownloader ¶
AddDownloader adds new downloader if it's not exist.
func BlockPackage ¶
BlockPackage blocks given package.
func DeleteRevisionById ¶
DeleteRevisionById delete revision by given ID.
func IncreasePackageDownloadCount ¶
IncreasePackageDownloadCount increase package download count by 1.
func IsPackageBlocked ¶
IsPackageBlocked checks if a package is blocked.
func RunBlockRule ¶
RunBlockRule applies given block rule to all packages.
func UnblockPackage ¶
func UpdateRevision ¶
UpdateRevision updates revision information.
Types ¶
type Block ¶
Block represents information of a blocked package.
func ListBlockedPackages ¶
ListBlockedPackages returns a list of block rules with given offset.
type BlockError ¶
type BlockError struct {
// contains filtered or unexported fields
}
BlockError represents a block error which contains block note.
func (*BlockError) Error ¶
func (e *BlockError) Error() string
type BlockRule ¶
BlockRule represents a rule for blocking packages.
func GetBlockRuleByID ¶
GetBlockRuleByID returns a block rule by given ID.
func ListBlockRules ¶
ListBlockRules returns a list of block rules with given offset.
type DownloadStats ¶
type DownloadStats struct {
NumTotalDownload int64
}
type Downloader ¶
Downloader represents a package download IP.
type Package ¶
type Package struct { ID int64 `xorm:"pk autoincr"` ImportPath string `xorm:"UNIQUE"` Description string Homepage string Issues string DownloadCount int64 RecentDownload int64 IsValidated bool `xorm:"DEFAULT 0"` Created time.Time `xorm:"CREATED"` }
Package represents a Go package.
func GetPakcageByID ¶
GetPakcageByID returns a package by given ID.
func GetPakcageByPath ¶
GetPakcageByPath returns a package by given import path.
func SearchPackages ¶
SearchPackages searchs packages by given keyword.
func (*Package) GetRevisions ¶
type Revision ¶
type Revision struct { ID int64 `xorm:"pk autoincr"` PkgID int64 `xorm:"UNIQUE(s)"` Pkg *Package `xorm:"-"` Revision string `xorm:"UNIQUE(s)"` Storage Size int64 Updated time.Time `xorm:"UPDATED"` }
Revision represents a revision of a Go package.
func GetLocalRevisions ¶
GetLocalRevisions returns all revisions that archives are saved locally.
func GetRevision ¶
GetRevision returns revision by given pakcage ID and revision.
func GetRevisionsByPkgId ¶
GetRevisionsByPkgId returns a list of revisions of given package ID.