store

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package store provides MySQL-backed metadata storage for the Epoch control plane.

MySQL serves as an index/cache over the object-store-backed registry. Object storage remains the source of truth for blobs; MySQL provides queryable metadata.

Index

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 is a DB blob record.

type DashboardStats

type DashboardStats struct {
	RepositoryCount int   `json:"repositoryCount"`
	TagCount        int   `json:"tagCount"`
	BlobCount       int   `json:"blobCount"`
	TotalSize       int64 `json:"totalSize"`
}

DashboardStats holds aggregate stats for the UI dashboard.

type Repository

type Repository struct {
	ID        int64     `json:"id"`
	Name      string    `json:"name"`
	TagCount  int       `json:"tagCount"`
	TotalSize int64     `json:"totalSize"`
	CreatedAt time.Time `json:"createdAt"`
	UpdatedAt time.Time `json:"updatedAt"`
}

Repository is a DB repository record.

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store wraps a MySQL connection for Epoch metadata.

func New

func New(ctx context.Context, dsn string) (*Store, error)

New opens a MySQL connection and runs migrations.

func (*Store) Close

func (s *Store) Close() error

Close closes the database connection.

func (*Store) CreateToken

func (s *Store) CreateToken(ctx context.Context, name, createdBy string) (string, error)

CreateToken generates and stores a new token. Returns the plaintext.

func (*Store) DeleteTag

func (s *Store) DeleteTag(ctx context.Context, repoName, tagName string) error

func (*Store) DeleteToken

func (s *Store) DeleteToken(ctx context.Context, id int64) error

DeleteToken removes a token by ID.

func (*Store) GetRepository

func (s *Store) GetRepository(ctx context.Context, name string) (*Repository, error)

func (*Store) GetStats

func (s *Store) GetStats(ctx context.Context) (*DashboardStats, error)

func (*Store) GetTag

func (s *Store) GetTag(ctx context.Context, repoName, tagName string) (*Tag, error)

func (*Store) ListRepositories

func (s *Store) ListRepositories(ctx context.Context) ([]Repository, error)

func (*Store) ListTags

func (s *Store) ListTags(ctx context.Context, repoName string) ([]Tag, error)

func (*Store) ListTokens

func (s *Store) ListTokens(ctx context.Context) ([]Token, error)

ListTokens returns all tokens with plaintext visible.

func (*Store) SyncFromCatalog

func (s *Store) SyncFromCatalog(ctx context.Context, reg *registry.Registry) error

SyncFromCatalog reads the remote catalog and syncs all metadata into MySQL.

func (*Store) ValidateToken

func (s *Store) ValidateToken(ctx context.Context, plaintext string) bool

ValidateToken checks if a token exists. Updates last_used on match.

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"`
	ManifestJSON string    `json:"-"`
	TotalSize    int64     `json:"totalSize"`
	LayerCount   int       `json:"layerCount"`
	PushedAt     time.Time `json:"pushedAt"`
	SyncedAt     time.Time `json:"syncedAt"`
}

Tag is a DB tag record.

type Token

type Token struct {
	ID        int64      `json:"id"`
	Name      string     `json:"name"`
	Token     string     `json:"token"`
	CreatedBy string     `json:"createdBy"`
	CreatedAt time.Time  `json:"createdAt"`
	LastUsed  *time.Time `json:"lastUsed,omitempty"`
}

Token is a registry access token.

Jump to

Keyboard shortcuts

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