models

package
v0.0.0-...-b9a05f1 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2017 License: Apache-2.0 Imports: 8 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DB *gorm.DB
)

Functions

func Migrate

func Migrate()

Migrate is

func OpenDatabase

func OpenDatabase()

OpenDatabase is

Types

type ACIv1

type ACIv1 struct {
	ID        int64      `json:"id" gorm:"primary_key"`
	AppcV1    int64      `json:"appc_v1" sql:"not null;default:0" gorm:"unique_index:aciv1"`
	Name      string     `json:"name" sql:"not null;type:varchar(255)" gorm:"unique_index:aciv1"`
	OS        string     `json:"os" sql:"null;type:varchar(255)"`
	Arch      string     `json:"arch" sql:"null;type:varchar(255)"`
	Version   string     `json:"version" sql:"null;type:varchar(255)"`
	Manifest  string     `json:"manifest" sql:"null;type:text"`
	OSS       string     `json:"name" sql:"null;type:text"`
	Path      string     `json:"pach" sql:"null;type:text"`
	Sign      string     `json:"sign" sql:"null;type:text"`
	Size      int64      `json:"size" sql:"default:0"`
	Locked    bool       `json:"locked" sql:"default:false"`
	CreatedAt time.Time  `json:"create_at" sql:""`
	UpdatedAt time.Time  `json:"update_at" sql:""`
	DeletedAt *time.Time `json:"delete_at" sql:"index"`
}

ACIv1 is

func (*ACIv1) Get

func (i *ACIv1) Get(appcv1 int64, version, name string) error

Get is

func (*ACIv1) PutACI

func (i *ACIv1) PutACI(appcv1, size int64, version, name, aci string) error

PutACI is

func (*ACIv1) PutManifest

func (i *ACIv1) PutManifest(appcv1 int64, version, name, manifest string) error

PutManifest is

func (*ACIv1) PutSign

func (i *ACIv1) PutSign(appcv1 int64, version, name, sign string) error

PutSign is

func (*ACIv1) TableName

func (i *ACIv1) TableName() string

TableName is

func (*ACIv1) Unlocked

func (i *ACIv1) Unlocked(appcv1 int64, version, name string) error

Unlocked is

type AppV1

type AppV1 struct {
	ID          int64      `json:"id" gorm:"primary_key"`
	Namespace   string     `json:"namespace" sql:"not null;type:varchar(255)"`
	Repository  string     `json:"repository" sql:"not null;type:varchar(255)"`
	Short       string     `json:"short" sql:"null;type:text"`
	Description string     `json:"description" sql:"null;type:text"`
	Manifests   string     `json:"manifests" sql:"null;type:text"`
	Keys        string     `json:"keys" sql:"null;type:text"`
	Size        int64      `json:"size" sql:"default:0"`
	Locked      bool       `json:"locked" sql:"default:false"`
	CreatedAt   time.Time  `json:"create_at" sql:""`
	UpdatedAt   time.Time  `json:"update_at" sql:""`
	DeletedAt   *time.Time `json:"delete_at" sql:"index"`
}

AppV1 is the App V1 repository

func NewAppV1

func NewAppV1(namespace, repository string) (AppV1, error)

NewAppV1 returns the namespace/repository, it will create the repository if it is not exist

func (*AppV1) Delete

func (app *AppV1) Delete(artifact ArtifactV1) error

Delete removes an artifact from a repository

func (*AppV1) Put

func (app *AppV1) Put(artifact ArtifactV1) error

Put adds an artifact to a repository

func (*AppV1) TableName

func (*AppV1) TableName() string

TableName returns the name of AppV1 table in mysql

type AppcV1

type AppcV1 struct {
	ID          int64      `json:"id" gorm:"primary_key"`
	Namespace   string     `json:"namespace" sql:"not null;type:varchar(255)"  gorm:"unique_index:appcv1_repository"`
	Repository  string     `json:"repository" sql:"not null;type:varchar(255)" gorm:"unique_index:appcv1_repository"`
	Short       string     `json:"short" sql:"null;type:text"`
	Description string     `json:"description" sql:"null;type:text"`
	Keys        string     `json:"keys" sql:"null;type:text"`
	Size        int64      `json:"size" sql:"default:0"`
	CreatedAt   time.Time  `json:"create_at" sql:""`
	UpdatedAt   time.Time  `json:"update_at" sql:""`
	DeletedAt   *time.Time `json:"delete_at" sql:"index"`
}

AppcV1 is

func (*AppcV1) Get

func (r *AppcV1) Get(namespace, repository string) error

Get is

func (*AppcV1) Put

func (r *AppcV1) Put(namespace, repository string) error

Put is

func (*AppcV1) TableName

func (r *AppcV1) TableName() string

TableName is

type ArtifactV1

type ArtifactV1 struct {
	ID            int64  `json:"id" gorm:"primary_key"`
	AppV1ID       int64  `json:"app_v1_id" sql:"not null;default:0"`
	OS            string `json:"os" sql:"null;type:varchar(255)"`
	Arch          string `json:"arch" sql:"null;type:varchar(255)"`
	Type          string `json:"type" sql:"null;type:varchar(255)"`
	App           string `json:"app" sql:"not null;varchar(255)" gorm:"unique_index:app_tag"`
	Tag           string `json:"tag" sql:"null;varchar(255)" gorm:"unique_index:app_tag"`
	Manifests     string `json:"manifests" sql:"null;type:text"`
	OSS           string `json:"oss" sql:"null;type:text"`
	EncryptMethod string `json:"encrypt" sql:"null;type:text"`
	// FIXME: Path is both the `URL` of the local storage and the `KEY` of the object storage
	Path      string     `json:"path" sql:"null;type:text"`
	Size      int64      `json:"size" sql:"default:0"`
	Locked    bool       `json:"locked" sql:"default:false"`
	CreatedAt time.Time  `json:"create_at" sql:""`
	UpdatedAt time.Time  `json:"update_at" sql:""`
	DeletedAt *time.Time `json:"delete_at" sql:"index"`
}

ArtifactV1 is the Artifcat V1 object

func (*ArtifactV1) Get

func (a *ArtifactV1) Get() (ArtifactV1, error)

Get gets full info by os/arch/app/tag

func (*ArtifactV1) GetName

func (a *ArtifactV1) GetName() string

func (*ArtifactV1) TableName

func (*ArtifactV1) TableName() string

TableName returns the name of ArtifactV1 table in mysql

type DockerImageV1

type DockerImageV1 struct {
	ID         int64      `json:"id" gorm:"primary_key"`
	ImageID    string     `json:"image_id" sql:"not null;unique;varchar(255)"`
	JSON       string     `json:"json" sql:"null;type:text"`
	Ancestry   string     `json:"ancestry" sql:"null;type:text"`
	Checksum   string     `json:"checksum" sql:"null;type:varchar(255)"`
	Payload    string     `json:"payload" sql:"null;type:varchar(255)"`
	Path       string     `json:"path" sql:"null;type:text"`
	OSS        string     `json:"oss" sql:"null;type:text"`
	Size       int64      `json:"size" sql:"default:0"`
	Uploaded   bool       `json:"uploaded" sql:"default:false"`
	Checksumed bool       `json:"checksumed" sql:"default:false"`
	Locked     bool       `json:"locked" sql:"default:false"`
	CreatedAt  time.Time  `json:"create_at" sql:""`
	UpdatedAt  time.Time  `json:"update_at" sql:""`
	DeletedAt  *time.Time `json:"delete_at" sql:"index"`
}

DockerImageV1 is

func (*DockerImageV1) Get

func (i *DockerImageV1) Get(imageID string) (DockerImageV1, error)

Get is search image by ImageID.

func (*DockerImageV1) PutChecksum

func (i *DockerImageV1) PutChecksum(imageID, checksum, payload string) error

PutChecksum is put image's checksum, payload and ancestry.

func (*DockerImageV1) PutJSON

func (i *DockerImageV1) PutJSON(imageID, json string) error

PutJSON is put image json by ImageID.

func (*DockerImageV1) PutLayer

func (i *DockerImageV1) PutLayer(imageID, path string, size int64) error

PutLayer is put image layer, path, uploaded and size.

func (*DockerImageV1) TableName

func (i *DockerImageV1) TableName() string

TableName in mysql is "docker_image_v1".

type DockerImageV2

type DockerImageV2 struct {
	ID              int64      `json:"id" gorm:"primary_key"`
	ImageID         string     `json:"image_id" sql:"null;type:varchar(255)"`
	BlobSum         string     `json:"blob_sum" sql:"null;type:varchar(255)"`
	V1Compatibility string     `json:"v1_compatibility" sql:"null;type:text"`
	Path            string     `json:"path" sql:"null;type:text"`
	OSS             string     `json:"oss" sql:"null;type:text"`
	Size            int64      `json:"size" sql:"default:0"`
	Locked          bool       `json:"locked" sql:"default:false"`
	CreatedAt       time.Time  `json:"create_at" sql:""`
	UpdatedAt       time.Time  `json:"update_at" sql:""`
	DeletedAt       *time.Time `json:"delete_at" sql:"index"`
}

DockerImageV2 is

func (*DockerImageV2) Get

func (i *DockerImageV2) Get(blobsum string) error

Get is

func (*DockerImageV2) Put

func (i *DockerImageV2) Put(tarsum, path string, size int64) error

Put is

func (*DockerImageV2) TableName

func (i *DockerImageV2) TableName() string

TableName is

type DockerTagV1

type DockerTagV1 struct {
	ID        int64      `json:"id" gorm:"primary_key"`
	DockerV1  int64      `json:"docker_v1" sql:"not null;default:0"`
	Tag       string     `json:"tag" sql:"not null;varchar(255)"`
	ImageID   string     `json:"image_id" sql:"not null;varchar(255)"`
	CreatedAt time.Time  `json:"create_at" sql:""`
	UpdatedAt time.Time  `json:"update_at" sql:""`
	DeletedAt *time.Time `json:"delete_at" sql:"index"`
}

DockerTagV1 is

func (*DockerTagV1) Put

func (t *DockerTagV1) Put(imageID, tag, namespace, repository string) error

Put is set tag in the database.

func (*DockerTagV1) TableName

func (t *DockerTagV1) TableName() string

TableName in mysql is "docker_tag_v1".

type DockerTagV2

type DockerTagV2 struct {
	ID            int64      `json:"id" gorm:"primary_key"`
	DockerV2      int64      `json:"docker_v2" sql:"not null;default:0"`
	Tag           string     `json:"tag" sql:"not null;type:varchar(255)"`
	ImageID       string     `json:"image_id" sql:"not null;type:varchar(255)"`
	Manifest      string     `json:"manifest" sql:"null;type:text"`
	SchemaVersion string     `json:"schema_version" sql:"not null;type:varchar(255)"`
	CreatedAt     time.Time  `json:"create_at" sql:""`
	UpdatedAt     time.Time  `json:"update_at" sql:""`
	DeletedAt     *time.Time `json:"delete_at" sql:"index"`
}

DockerTagV2 is

func (*DockerTagV2) Get

func (t *DockerTagV2) Get(namespace, repository, tag string) (*DockerTagV2, error)

Get is get DockerTagV2 data

func (*DockerTagV2) Put

func (t *DockerTagV2) Put(namespace, repository, tag, imageID, manifest, schema string) error

Put is

func (*DockerTagV2) TableName

func (t *DockerTagV2) TableName() string

TableName is

type DockerV1

type DockerV1 struct {
	ID          int64      `json:"id" gorm:"primary_key"`
	Namespace   string     `json:"namespace" sql:"not null;type:varchar(255)" gorm:"unique_index:dockerv1_repository"`
	Repository  string     `json:"repository" sql:"not null;type:varchar(255)" gorm:"unique_index:dockerv1_repository"`
	JSON        string     `json:"json" sql:"null;type:text"`
	Manifests   string     `json:"manifests" sql:"null;type:text"`
	Agent       string     `json:"agent" sql:"null;type:text"`
	Short       string     `json:"short" sql:"null;type:text"`
	Description string     `json:"description" sql:"null;type:text"`
	Size        int64      `json:"size" sql:"default:0"`
	Locked      bool       `json:"locked" sql:"default:false"` //When create/update the repository, the locked will be true.
	CreatedAt   time.Time  `json:"create_at" sql:""`
	UpdatedAt   time.Time  `json:"update_at" sql:""`
	DeletedAt   *time.Time `json:"delete_at" sql:"index"`
}

DockerV1 is Docker Repository V1 repository.

func (*DockerV1) Get

func (r *DockerV1) Get(namespace, repository string) (DockerV1, error)

Get return Docker V1 repository data.

func (*DockerV1) GetTags

func (r *DockerV1) GetTags(namespace, repository string) (map[string]string, error)

GetTags return tas data of repository.

func (*DockerV1) Put

func (r *DockerV1) Put(namespace, repository, json, agent string) error

Put function will create or update repository.

func (*DockerV1) TableName

func (r *DockerV1) TableName() string

TableName in mysql is "docker_v1".

func (*DockerV1) Unlocked

func (r *DockerV1) Unlocked(namespace, repository string) error

Unlocked is Unlocked repository data so could pull.

type DockerV2

type DockerV2 struct {
	ID            int64      `json:"id" gorm:"primary_key"`
	Namespace     string     `json:"namespace" sql:"not null;type:varchar(255)"  gorm:"unique_index:dockerv2_repository"`
	Repository    string     `json:"repository" sql:"not null;type:varchar(255)"  gorm:"unique_index:dockerv2_repository"`
	SchemaVersion string     `json:"schema_version" sql:"not null;type:varchar(255)"`
	Manifests     string     `json:"manifests" sql:"null;type:text"`
	Agent         string     `json:"agent" sql:"null;type:text"`
	Short         string     `json:"short" sql:"null;type:text"`
	Description   string     `json:"description" sql:"null;type:text"`
	Size          int64      `json:"size" sql:"default:0"`
	Locked        bool       `json:"locked" sql:"default:false"`
	CreatedAt     time.Time  `json:"create_at" sql:""`
	UpdatedAt     time.Time  `json:"update_at" sql:""`
	DeletedAt     *time.Time `json:"delete_at" sql:"index"`
}

DockerV2

func (*DockerV2) Get

func (r *DockerV2) Get(namespace, repository string) error

Get is

func (*DockerV2) GetTags

func (r *DockerV2) GetTags(namespace, repository string) ([]string, error)

GetTags return tas data of repository.

func (*DockerV2) Put

func (r *DockerV2) Put(namespace, repository string) error

Put is

func (*DockerV2) PutAgent

func (r *DockerV2) PutAgent(namespace, repository, agent, version string) error

PutAgent is

func (*DockerV2) TableName

func (r *DockerV2) TableName() string

TableName is

type ImageV1

type ImageV1 struct {
	ID          int64      `json:"id" gorm:"primary_key"`
	Namespace   string     `json:"namespace" sql:"not null;type:varchar(255)"`
	Repository  string     `json:"repository" sql:"not null;type:varchar(255)"`
	Short       string     `json:"short" sql:"null;type:text"`
	Description string     `json:"description" sql:"null;type:text"`
	Manifests   string     `json:"manifests" sql:"null;type:text"`
	Type        string     `json:"type" sql:"not null;type:varchar(255)"`
	Keys        string     `json:"keys" sql:"null;type:text"`
	Size        int64      `json:"size" sql:"default:0"`
	Locked      bool       `json:"locked" sql:"default:false"`
	CreatedAt   time.Time  `json:"create_at" sql:""`
	UpdatedAt   time.Time  `json:"update_at" sql:""`
	DeletedAt   *time.Time `json:"delete_at" sql:"index"`
}

func (*ImageV1) TableName

func (*ImageV1) TableName() string

type VirtualV1

type VirtualV1 struct {
	ID        int64      `json:"id" gorm:"primary_key"`
	ImageV1   int64      `json:"image_v1" sql:"not null"`
	OS        string     `json:"os" sql:"null;type:varchar(255)"`
	Arch      string     `json:"arch" sql:"null;type:varchar(255)"`
	Image     string     `json:"image" sql:"not null;varchar(255)" gorm:"unique_index:image_tag"`
	Tag       string     `json:"tag" sql:"null;varchar(255)" gorm:"unique_index:image_tag"`
	Manifests string     `json:"manifests" sql:"null;type:text"`
	OSS       string     `json:"oss" sql:"null;type:text"`
	Path      string     `json:"arch" sql:"null;type:text"`
	Size      int64      `json:"size" sql:"default:0"`
	Locked    bool       `json:"locked" sql:"default:false"`
	CreatedAt time.Time  `json:"create_at" sql:""`
	UpdatedAt time.Time  `json:"update_at" sql:""`
	DeletedAt *time.Time `json:"delete_at" sql:"index"`
}

func (*VirtualV1) TableName

func (*VirtualV1) TableName() string

Jump to

Keyboard shortcuts

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