artefacts

package
v0.387.1 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ModuleArtifactPrefix = "ftl/modules/"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Artefact

type Artefact struct {
	Digest   sha256.SHA256
	Metadata Metadata
	Content  []byte
}

Artefact container for an artefact's payload and metadata

type ArtefactKey

type ArtefactKey struct {
	Digest sha256.SHA256
}

type ArtefactRepository added in v0.379.0

type ArtefactRepository struct {
	ModuleDigest     sha256.SHA256
	MediaType        string
	ArtefactType     string
	RepositoryDigest digest.Digest
	Size             int64
}

type ArtefactRow

type ArtefactRow struct {
	ID     int64
	Digest []byte
}

type ContainerConfig added in v0.379.0

type ContainerConfig struct {
	Registry       string `help:"OCI container registry host:port" env:"FTL_ARTEFACTS_REGISTRY"`
	Username       string `help:"OCI container registry username" env:"FTL_ARTEFACTS_USER"`
	Password       string `help:"OCI container registry password" env:"FTL_ARTEFACTS_PWD"`
	AllowPlainHTTP bool   `help:"Allows OCI container requests to accept plain HTTP responses" env:"FTL_ARTEFACTS_ALLOW_HTTP"`
}

type ContainerService added in v0.379.0

type ContainerService struct {

	// in the interim releases and artefacts will continue to be linked via the `deployment_artefacts` table
	Handle *libdal.Handle[ContainerService]
	// contains filtered or unexported fields
}

func NewContainerService added in v0.379.0

func NewContainerService(c ContainerConfig, conn libdal.Connection) *ContainerService

func (*ContainerService) AddReleaseArtefact added in v0.379.0

func (s *ContainerService) AddReleaseArtefact(ctx context.Context, key model.DeploymentKey, ra ReleaseArtefact) error

func (*ContainerService) DiscoverArtefacts added in v0.379.0

func (s *ContainerService) DiscoverArtefacts(ctx context.Context, prefix string) ([]ArtefactRepository, error)

func (*ContainerService) DiscoverModuleArtefacts added in v0.379.0

func (s *ContainerService) DiscoverModuleArtefacts(ctx context.Context) ([]ArtefactRepository, error)

func (*ContainerService) Download added in v0.379.0

func (s *ContainerService) Download(ctx context.Context, digest sha256.SHA256) (io.ReadCloser, error)

func (*ContainerService) GetDigestsKeys added in v0.379.0

func (s *ContainerService) GetDigestsKeys(ctx context.Context, digests []sha256.SHA256) (keys []ArtefactKey, missing []sha256.SHA256, err error)

func (*ContainerService) GetReleaseArtefacts added in v0.379.0

func (s *ContainerService) GetReleaseArtefacts(ctx context.Context, releaseID int64) ([]ReleaseArtefact, error)

func (*ContainerService) Upload added in v0.379.0

func (s *ContainerService) Upload(ctx context.Context, artefact Artefact) (sha256.SHA256, error)

type DAL

type DAL interface {
	GetArtefactDigests(ctx context.Context, digests [][]byte) ([]ArtefactRow, error)
	CreateArtefact(ctx context.Context, digest []byte, content []byte) (int64, error)
	GetArtefactContentRange(ctx context.Context, start int32, count int32, iD int64) ([]byte, error)
}

type Metadata

type Metadata struct {
	Executable bool
	Path       string
}

Metadata container for an artefact's metadata

type Registry

type Registry interface {
	// GetDigestsKeys locates the `digests` corresponding `ArtefactKey`s and identifies the missing ones
	GetDigestsKeys(ctx context.Context, digests []sha256.SHA256) (keys []ArtefactKey, missing []sha256.SHA256, err error)
	// Upload pushes the specified media, and metadata, to the registry and returns the computed digest
	Upload(context context.Context, artefact Artefact) (sha256.SHA256, error)
	// Download performs a streaming download of the artefact identified by the supplied digest
	Download(context context.Context, digest sha256.SHA256) (io.ReadCloser, error)
	// GetReleaseArtefacts locates the artefacts metadata corresponding with the specified release
	GetReleaseArtefacts(ctx context.Context, releaseID int64) ([]ArtefactKey, error)
	// AddReleaseArtefact associates the given `release` with the artefact associated with the given `digest`
	AddReleaseArtefact(ctx context.Context, key model.DeploymentKey, ra ReleaseArtefact) error
}

type ReleaseArtefact

type ReleaseArtefact struct {
	Artefact   ArtefactKey
	Path       string
	Executable bool
}

type Service

type Service struct {
	*libdal.Handle[Service]
	// contains filtered or unexported fields
}

func New

func New(conn libdal.Connection) *Service

func (*Service) AddReleaseArtefact

func (s *Service) AddReleaseArtefact(ctx context.Context, key model.DeploymentKey, ra ReleaseArtefact) error

func (*Service) Download

func (s *Service) Download(ctx context.Context, digest sha256.SHA256) (io.ReadCloser, error)

func (*Service) GetDigestsKeys

func (s *Service) GetDigestsKeys(ctx context.Context, digests []sha256.SHA256) (keys []ArtefactKey, missing []sha256.SHA256, err error)

func (*Service) GetReleaseArtefacts

func (s *Service) GetReleaseArtefacts(ctx context.Context, releaseID int64) ([]ReleaseArtefact, error)

func (*Service) Upload

func (s *Service) Upload(ctx context.Context, artefact Artefact) (sha256.SHA256, error)

Directories

Path Synopsis
internal
sql

Jump to

Keyboard shortcuts

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