metadata

package
v0.0.0-...-61af640 Latest Latest
Warning

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

Go to latest
Published: May 25, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FederatedCrewStore

type FederatedCrewStore interface {
	PublishPackage(ctx context.Context, tenantID string, name string, version string, digest string, sizeBytes int64, storageKey string, manifest []byte, publishedBy string) error
	FetchPackage(ctx context.Context, tenantID string, name string, version string) (*RegistryPackageInfo, error)
	ListPackages(ctx context.Context, tenantID string) ([]RegistryPackageInfo, error)
}

type MockRegistryStore

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

func NewMockRegistryStore

func NewMockRegistryStore() *MockRegistryStore

func (*MockRegistryStore) FetchPackage

func (m *MockRegistryStore) FetchPackage(ctx context.Context, tenantID string, name string, version string) (*RegistryPackageInfo, error)

func (*MockRegistryStore) ListPackages

func (m *MockRegistryStore) ListPackages(ctx context.Context, tenantID string) ([]RegistryPackageInfo, error)

func (*MockRegistryStore) PublishPackage

func (m *MockRegistryStore) PublishPackage(ctx context.Context, tenantID string, name string, version string, digest string, sizeBytes int64, storageKey string, manifest []byte, publishedBy string) error

type Package

type Package struct {
	ID        int64     `json:"id"`
	TenantID  string    `json:"tenant_id"`
	Name      string    `json:"name"`
	CreatedAt time.Time `json:"created_at"`
}

Package represents a logical package (name within a tenant).

type PackageManifest

type PackageManifest struct {
	Name         string   `json:"name"`
	Version      string   `json:"version"`
	Description  string   `json:"description,omitempty"`
	Type         string   `json:"type"` // "agent" | "crew" | "template"
	Entrypoint   string   `json:"entrypoint,omitempty"`
	Dependencies []string `json:"dependencies,omitempty"`
	Labels       []string `json:"labels,omitempty"`
}

PackageManifest is the minimal metadata file expected inside every published artifact (usually at the root of the tarball as manifest.json or drover-registry.json).

This is the core of dreg-002 "Version indexing & metadata API parser".

func ExtractManifestFromTarball

func ExtractManifestFromTarball(r io.Reader) (*PackageManifest, []byte, error)

ExtractManifestFromTarball looks inside a .tar.gz (or .tar) for a file named manifest.json (or drover-registry.json / package.json) at the root and parses it.

func ParseManifest

func ParseManifest(r io.Reader) (*PackageManifest, error)

ParseManifest reads a manifest.json from an io.Reader (usually from inside the uploaded tarball).

type PackageVersion

type PackageVersion struct {
	ID          int64           `json:"id"`
	PackageID   int64           `json:"package_id"`
	Version     string          `json:"version"`
	Digest      string          `json:"digest"`
	SizeBytes   int64           `json:"size_bytes"`
	StorageKey  string          `json:"storage_key"`
	Manifest    json.RawMessage `json:"manifest"`
	PublishedBy string          `json:"published_by"`
	CreatedAt   time.Time       `json:"created_at"`
}

PackageVersion is one specific version of a package.

type RegistryPackageInfo

type RegistryPackageInfo struct {
	Name        string `json:"name"`
	Version     string `json:"version"`
	Digest      string `json:"digest"`
	SizeBytes   int64  `json:"size_bytes"`
	PublishedBy string `json:"published_by"`
}

type Store

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

Store provides metadata persistence over Postgres.

func NewStore

func NewStore(db *infra.DB) *Store

func (*Store) FetchPackage

func (s *Store) FetchPackage(ctx context.Context, tenantID string, name string, version string) (*RegistryPackageInfo, error)

FetchPackage retrieves a specific version's registry details.

func (*Store) GetVersionByDigest

func (s *Store) GetVersionByDigest(ctx context.Context, tenantID, name, digest string) (*PackageVersion, error)

GetVersionByDigest looks up a specific version using the content digest (very useful for OCI-like resolution).

func (*Store) GetVersionByNameVersion

func (s *Store) GetVersionByNameVersion(ctx context.Context, tenantID, name, version string) (*PackageVersion, error)

GetVersionByNameVersion is a convenience lookup (used by fetch if we want to resolve without digest).

func (*Store) InsertVersion

func (s *Store) InsertVersion(ctx context.Context, pkgID int64, v *PackageVersion) error

InsertVersion records a new version (assumes package exists).

func (*Store) ListPackages

func (s *Store) ListPackages(ctx context.Context, tenantID string) ([]RegistryPackageInfo, error)

ListPackages retrieves all published package versions inside a tenant scope.

func (*Store) ListVersions

func (s *Store) ListVersions(ctx context.Context, tenantID, name string) ([]PackageVersion, error)

ListVersions returns all versions for a given package in a tenant (newest first).

func (*Store) PublishPackage

func (s *Store) PublishPackage(ctx context.Context, tenantID string, name string, version string, digest string, sizeBytes int64, storageKey string, manifest []byte, publishedBy string) error

PublishPackage publishes a new package version or updates it inside postgres storage.

func (*Store) SearchByManifestField

func (s *Store) SearchByManifestField(ctx context.Context, tenantID, field, value string, limit int) ([]PackageVersion, error)

SearchByManifestField is a simple example of querying inside the JSONB manifest (e.g. by type or label).

func (*Store) UpsertPackage

func (s *Store) UpsertPackage(ctx context.Context, tenantID, name string) (int64, error)

UpsertPackage ensures the (tenant, name) pair exists and returns its ID.

Jump to

Keyboard shortcuts

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