packages

package
v1.19.3 Latest Latest
Warning

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

Go to latest
Published: May 3, 2023 License: MIT Imports: 19 Imported by: 29

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrQuotaTypeSize   = errors.New("maximum allowed package type size exceeded")
	ErrQuotaTotalSize  = errors.New("maximum allowed package storage quota exceeded")
	ErrQuotaTotalCount = errors.New("maximum allowed package count exceeded")
)

Functions

func AddFileToExistingPackage

AddFileToExistingPackage adds a file to an existing package. If the package does not exist, ErrPackageNotExist is returned

func CheckCountQuotaExceeded added in v1.19.0

func CheckCountQuotaExceeded(ctx context.Context, doer, owner *user_model.User) error

CheckCountQuotaExceeded checks if the owner has more than the allowed packages The check is skipped if the doer is an admin.

func CheckSizeQuotaExceeded added in v1.19.0

func CheckSizeQuotaExceeded(ctx context.Context, doer, owner *user_model.User, packageType packages_model.Type, uploadSize int64) error

CheckSizeQuotaExceeded checks if the upload size is bigger than the allowed size The check is skipped if the doer is an admin.

func CreateAuthorizationToken

func CreateAuthorizationToken(u *user_model.User) (string, error)

func CreatePackageAndAddFile

CreatePackageAndAddFile creates a package with a file. If the same package exists already, ErrDuplicatePackageVersion is returned

func CreatePackageOrAddFileToExisting

CreatePackageOrAddFileToExisting creates a package with a file or adds the file if the package exists already

func DeletePackageFile

func DeletePackageFile(ctx context.Context, pf *packages_model.PackageFile) error

DeletePackageFile deletes the package file and its properties

func DeletePackageVersionAndReferences

func DeletePackageVersionAndReferences(ctx context.Context, pv *packages_model.PackageVersion) error

DeletePackageVersionAndReferences deletes the package version and its properties and files

func GetFileStreamByPackageNameAndVersion

func GetFileStreamByPackageNameAndVersion(ctx context.Context, pvi *PackageInfo, pfi *PackageFileInfo) (io.ReadSeekCloser, *packages_model.PackageFile, error)

GetFileStreamByPackageNameAndVersion returns the content of the specific package file

func GetFileStreamByPackageVersion

GetFileStreamByPackageVersion returns the content of the specific package file

func GetFileStreamByPackageVersionAndFileID

func GetFileStreamByPackageVersionAndFileID(ctx context.Context, owner *user_model.User, versionID, fileID int64) (io.ReadSeekCloser, *packages_model.PackageFile, error)

GetFileStreamByPackageVersionAndFileID returns the content of the specific package file

func GetPackageFileStream

GetPackageFileStream returns the content of the specific package file

func NewPackageBlob

NewPackageBlob creates a package blob instance

func ParseAuthorizationToken

func ParseAuthorizationToken(req *http.Request) (int64, error)

func RemoveAllPackages added in v1.17.4

func RemoveAllPackages(ctx context.Context, userID int64) (int, error)

RemoveAllPackages for User

func RemovePackageVersion

func RemovePackageVersion(doer *user_model.User, pv *packages_model.PackageVersion) error

RemovePackageVersion deletes the package version and all associated files

func RemovePackageVersionByNameAndVersion

func RemovePackageVersionByNameAndVersion(doer *user_model.User, pvi *PackageInfo) error

RemovePackageVersionByNameAndVersion deletes a package version and all associated files

Types

type PackageCreationInfo

type PackageCreationInfo struct {
	PackageInfo
	SemverCompatible  bool
	Creator           *user_model.User
	Metadata          interface{}
	PackageProperties map[string]string
	VersionProperties map[string]string
}

PackageCreationInfo describes a package to create

type PackageFileCreationInfo

type PackageFileCreationInfo struct {
	PackageFileInfo
	Creator           *user_model.User
	Data              packages_module.HashedSizeReader
	IsLead            bool
	Properties        map[string]string
	OverwriteExisting bool
}

PackageFileCreationInfo describes a package file to create

type PackageFileInfo

type PackageFileInfo struct {
	Filename     string
	CompositeKey string
}

PackageFileInfo describes a package file

type PackageInfo

type PackageInfo struct {
	Owner       *user_model.User
	PackageType packages_model.Type
	Name        string
	Version     string
}

PackageInfo describes a package

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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