Documentation
¶
Index ¶
- Variables
- func BlobPath(p string) string
- func GenerateSha256() string
- func NewRandomBlobWriter(ctx context.Context, store storage.ContentStorage) (storagedriver.FileWriter, string, error)
- func NewTemporaryWriter(ctx context.Context, store storage.ContentStorage, temporaryId string, ...) (storagedriver.FileWriter, error)
- func TemporaryPath(p string) string
- type ArtifactIndexUpdater
- type ArtifactPackageUploader
- type AssetDescriptor
- type CommitWriter
- type Hash
- type HashWriter
- type MetadataInterface
- type ModelAttribute
- type ModelManager
- type PackageDescriptor
- type PackageMetaDescriptor
- type StorageFileWriter
- type StorageFileWriterList
- type StorageLayout
- type VersionMetadata
- type ViewDescriptor
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrMissFormField = usererror.BadRequest("miss required form field") ErrMissPathField = usererror.BadRequest("path field is missing") ErrInvalidPackageName = usererror.BadRequest("invalid package name") ErrInvalidPackageVersion = usererror.BadRequest("invalid package version") ErrInvalidGroupName = usererror.BadRequest("invalid group name") ErrInvalidPackageContent = usererror.BadRequest("invalid package content") ErrStorageFileAlreadyExists = usererror.BadRequest("storage file already exists") ErrStorageFileNotChanged = usererror.BadRequest("storage file not changed") )
Functions ¶
func GenerateSha256 ¶
func GenerateSha256() string
func NewRandomBlobWriter ¶
func NewRandomBlobWriter(ctx context.Context, store storage.ContentStorage) (storagedriver.FileWriter, string, error)
func NewTemporaryWriter ¶
func NewTemporaryWriter(ctx context.Context, store storage.ContentStorage, temporaryId string, append bool) (storagedriver.FileWriter, error)
func TemporaryPath ¶
Types ¶
type ArtifactIndexUpdater ¶
type ArtifactIndexUpdater interface { // UpdatePackage will be called after a new version of package is upload, // some format-adapter need to generate package-level index file UpdatePackage(ctx context.Context, p *types.ArtifactPackage, v *types.ArtifactView) error // UpdateRepo will be called after a new version of package is upload, // some format-adapter need to generate repository-level index file UpdateRepo(ctx context.Context, v *types.ArtifactView) error CommitWriter }
ArtifactIndexUpdater is an index update interface every format-adapter should implement it
type ArtifactPackageUploader ¶
type AssetDescriptor ¶
type AssetDescriptor struct { Attr ModelAttribute Path string Ref string Size int64 Metadata MetadataInterface ContentType string Format types.ArtifactFormat Kind types.AssetKind Hash *Hash }
type CommitWriter ¶
type Hash ¶
type HashWriter ¶
type HashWriter struct {
// contains filtered or unexported fields
}
func NewHashWriter ¶
func NewHashWriter() *HashWriter
func (*HashWriter) Sum ¶
func (h *HashWriter) Sum() *Hash
type MetadataInterface ¶
type MetadataInterface interface {
ToJSON() (json.RawMessage, error)
}
type ModelAttribute ¶
type ModelAttribute string
const ( // AttrAssetNormal should be bind to a version AttrAssetNormal ModelAttribute = "normal" // AttrAssetIsolated does not bind to version nor view, used for container blobs AttrAssetIsolated ModelAttribute = "isolated" // AttrAssetExclusive require the version has only one asset, others should be removed AttrAssetExclusive ModelAttribute = "exclusive" // AttrAssetIndex only bind to view, used for generated index AttrAssetIndex ModelAttribute = "index" )
type ModelManager ¶
type ModelManager struct {
// contains filtered or unexported fields
}
func NewModelManager ¶
func NewModelManager(artStore store.ArtifactStore, view *ViewDescriptor, pkg *PackageDescriptor, creator *types.Principal) *ModelManager
func (*ModelManager) Sync ¶
func (mm *ModelManager) Sync(ctx context.Context, assetDesc *AssetDescriptor) (*types.ArtifactAsset, error)
type PackageDescriptor ¶
type PackageDescriptor struct { // The artifact package's name Name string Namespace string Version string VersionMetadata MetadataInterface Format types.ArtifactFormat // Upload file info MainAsset *AssetDescriptor // auto created sub files SubAssets []*AssetDescriptor }
func NewEmptyPackageDescriptor ¶
func NewEmptyPackageDescriptor() *PackageDescriptor
func (*PackageDescriptor) AddSub ¶
func (p *PackageDescriptor) AddSub(asset *AssetDescriptor)
type PackageMetaDescriptor ¶
type PackageMetaDescriptor struct { Name string Format types.ArtifactFormat MainAsset *AssetDescriptor // auto created sub files SubAssets []*AssetDescriptor }
func NewEmptyPackageMetaDescriptor ¶
func NewEmptyPackageMetaDescriptor() *PackageMetaDescriptor
func (*PackageMetaDescriptor) AddSub ¶
func (p *PackageMetaDescriptor) AddSub(asset *AssetDescriptor)
type StorageFileWriter ¶
type StorageFileWriter struct { Layout StorageLayout Writer storagedriver.FileWriter Key string Path string }
func NewStorageBlobWriter ¶
func NewStorageBlobWriter(ctx context.Context, store storage.ContentStorage, ref string, append bool) (*StorageFileWriter, error)
func NewStorageFileWriter ¶
func NewStorageFileWriter(ctx context.Context, path string, append bool, store storage.ContentStorage) (*StorageFileWriter, error)
func (*StorageFileWriter) SetPath ¶
func (s *StorageFileWriter) SetPath(p string)
type StorageFileWriterList ¶
type StorageFileWriterList []*StorageFileWriter
type StorageLayout ¶
type StorageLayout string
const ( StorageLayoutBlob StorageLayout = "blob" StorageLayoutPath StorageLayout = "path" )
type VersionMetadata ¶
type VersionMetadata struct {
CreatorName string `json:"creator_name"`
}
func (*VersionMetadata) ToJSON ¶
func (m *VersionMetadata) ToJSON() (json.RawMessage, error)
type ViewDescriptor ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.