package models import "time" // OCIRepository represents a named image repository within the registry. // Name mirrors the OCI distribution spec "name" component, e.g. "alice/myapp". type OCIRepository struct { ID int64 `xorm:"'id' pk autoincr" json:"id"` RepoID int64 `xorm:"'repo_id' notnull index" json:"repoId"` // FK to Repository (git repo that owns this image) Name string `xorm:"'name' varchar(255) unique" json:"name"` // e.g. "alice/myapp" CreatedAt time.Time `xorm:"'created_at' created" json:"createdAt"` } // OCIManifest stores a pushed image manifest (OCI or Docker schema2). // The full manifest JSON is stored in Content so it can be streamed without // going to disk. Manifests are small (typically <4 KB). type OCIManifest struct { ID int64 `xorm:"'id' pk autoincr" json:"id"` OCIRepoID int64 `xorm:"'oci_repo_id' notnull index" json:"ociRepoId"` Digest string `xorm:"'digest' varchar(80) notnull" json:"digest"` // "sha256:" MediaType string `xorm:"'media_type' varchar(150)" json:"mediaType"` Size int64 `xorm:"'size'" json:"size"` Content string `xorm:"'content' text" json:"-"` // raw JSON PushedAt time.Time `xorm:"'pushed_at' created" json:"pushedAt"` } // OCITag maps a mutable tag (e.g. "latest", "v1.2.3") to a manifest digest. type OCITag struct { ID int64 `xorm:"'id' pk autoincr" json:"id"` OCIRepoID int64 `xorm:"'oci_repo_id' notnull index" json:"ociRepoId"` Name string `xorm:"'name' varchar(128)" json:"name"` Digest string `xorm:"'digest' varchar(80)" json:"digest"` UpdatedAt time.Time `xorm:"'updated_at' updated" json:"updatedAt"` } // OCIBlob tracks a content-addressable blob. The actual content lives at // {oci_root}/blobs/sha256/ on the filesystem. type OCIBlob struct { ID int64 `xorm:"'id' pk autoincr" json:"id"` Digest string `xorm:"'digest' varchar(80) unique" json:"digest"` Size int64 `xorm:"'size'" json:"size"` CreatedAt time.Time `xorm:"'created_at' created" json:"createdAt"` } // OCIUpload tracks an in-progress blob upload session. type OCIUpload struct { ID int64 `xorm:"'id' pk autoincr" json:"id"` UploadID string `xorm:"'upload_id' varchar(64) unique" json:"uploadId"` // UUID used in URL Name string `xorm:"'name' varchar(255)" json:"name"` // image name Offset int64 `xorm:"'offset'" json:"offset"` ExpiresAt time.Time `xorm:"'expires_at'" json:"expiresAt"` CreatedAt time.Time `xorm:"'created_at' created" json:"createdAt"` }