Documentation
¶
Overview ¶
Package store provides MySQL-backed metadata storage. Object storage remains the source of truth.
Index ¶
- type Blob
- type DashboardStats
- type PlatformSize
- type PlatformSizes
- type Repository
- type Store
- func (s *Store) Close() error
- func (s *Store) CreateToken(ctx context.Context, name, createdBy string) (string, error)
- func (s *Store) DeleteTag(ctx context.Context, repoName, tagName string) error
- func (s *Store) DeleteToken(ctx context.Context, id int64) error
- func (s *Store) GetRepository(ctx context.Context, name string) (*Repository, error)
- func (s *Store) GetStats(ctx context.Context) (*DashboardStats, error)
- func (s *Store) GetTag(ctx context.Context, repoName, tagName string) (*Tag, error)
- func (s *Store) InvalidateTokenCache()
- func (s *Store) ListRepositories(ctx context.Context) ([]Repository, error)
- func (s *Store) ListTags(ctx context.Context, repoName string) ([]Tag, error)
- func (s *Store) ListTokens(ctx context.Context) ([]Token, error)
- func (s *Store) SyncFromCatalog(ctx context.Context, reg *registry.Registry) error
- func (s *Store) ValidateToken(ctx context.Context, plaintext string) bool
- type Tag
- type Token
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Blob ¶
type Blob struct {
Digest string `json:"digest"`
Size int64 `json:"size"`
MediaType string `json:"mediaType"`
RefCount int `json:"refCount"`
}
Blob represents a content-addressable blob row in the database.
type DashboardStats ¶
type DashboardStats struct {
RepositoryCount int `json:"repositoryCount"`
TagCount int `json:"tagCount"`
BlobCount int `json:"blobCount"`
TotalSize int64 `json:"totalSize"`
}
DashboardStats holds aggregate counts for the web UI dashboard.
type PlatformSize ¶ added in v0.1.7
type PlatformSize struct {
Digest string `json:"digest"`
Size int64 `json:"size"`
LayerCount int `json:"layerCount"`
}
PlatformSize stores per-platform size and layer count for image indexes.
type PlatformSizes ¶ added in v0.1.7
type PlatformSizes []PlatformSize
PlatformSizes round-trips through a MySQL JSON column; empty persists as NULL.
func (*PlatformSizes) Scan ¶ added in v0.1.7
func (p *PlatformSizes) Scan(src any) error
Scan unmarshals JSON from a MySQL column into PlatformSizes.
type Repository ¶
type Repository struct {
ID int64 `json:"id"`
Name string `json:"name"`
TagCount int `json:"tagCount"`
TotalSize int64 `json:"totalSize"`
ArtifactType string `json:"artifactType,omitempty"`
Kind string `json:"kind,omitempty"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
}
Repository represents a repository row with aggregated tag stats.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store provides MySQL-backed metadata queries and token management.
func (*Store) CreateToken ¶
CreateToken generates a random token, stores its hash, and returns the plaintext.
func (*Store) DeleteTag ¶
DeleteTag removes a tag from the database by repository name and tag name.
func (*Store) DeleteToken ¶
DeleteToken removes a token by ID and invalidates the cache.
func (*Store) GetRepository ¶
GetRepository returns a single repository by name, or nil if not found.
func (*Store) GetStats ¶
func (s *Store) GetStats(ctx context.Context) (*DashboardStats, error)
GetStats returns aggregate counts for the dashboard.
func (*Store) InvalidateTokenCache ¶ added in v0.1.7
func (s *Store) InvalidateTokenCache()
InvalidateTokenCache clears all cached token validation results.
func (*Store) ListRepositories ¶
func (s *Store) ListRepositories(ctx context.Context) ([]Repository, error)
ListRepositories returns all repositories ordered by last update.
func (*Store) ListTokens ¶
ListTokens returns all tokens ordered by ID.
func (*Store) SyncFromCatalog ¶
SyncFromCatalog ingests catalog entries into MySQL. Per-tag failures are non-fatal.
type Tag ¶
type Tag struct {
ID int64 `json:"id"`
RepositoryID int64 `json:"-"`
RepoName string `json:"repoName,omitempty"`
Name string `json:"name"`
Digest string `json:"digest"`
ArtifactType string `json:"artifactType,omitempty"`
Kind string `json:"kind,omitempty"`
ManifestJSON string `json:"-"`
TotalSize int64 `json:"totalSize"`
LayerCount int `json:"layerCount"`
PlatformSizes PlatformSizes `json:"platformSizes,omitempty"`
PushedAt time.Time `json:"pushedAt"`
SyncedAt time.Time `json:"syncedAt"`
}
Tag represents a manifest tag row in the database.
type Token ¶
type Token struct {
ID int64 `json:"id"`
Name string `json:"name"`
Token string `json:"token,omitempty"`
CreatedBy string `json:"createdBy"`
CreatedAt time.Time `json:"createdAt"`
LastUsed *time.Time `json:"lastUsed,omitempty"`
}
Token represents an API access token row in the database.