Help us shape the future of Go! Take the 2026 Go Developer Survey

artifact

package
v0.86.0 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Artifact

type Artifact struct {
	Key       string    `json:"key"`
	Size      int64     `json:"size"`
	CreatedAt time.Time `json:"created_at"`
	Checksum  string    `json:"checksum"` // SHA256 hex digest
}

Artifact represents metadata about a stored artifact.

type LocalStore

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

LocalStore implements Store using the local filesystem. Artifacts are stored under {baseDir}/artifacts/{executionID}/{key}. Metadata (size, checksum, timestamp) is tracked in memory.

func NewLocalStore

func NewLocalStore(baseDir string) *LocalStore

NewLocalStore creates a new LocalStore rooted at baseDir.

func (*LocalStore) Delete

func (s *LocalStore) Delete(_ context.Context, executionID, key string) error

Delete removes an artifact from the local filesystem and metadata.

func (*LocalStore) Get

func (s *LocalStore) Get(_ context.Context, executionID, key string) (io.ReadCloser, error)

Get retrieves an artifact from the local filesystem.

func (*LocalStore) List

func (s *LocalStore) List(_ context.Context, executionID string) ([]Artifact, error)

List returns all artifacts for a given execution ID, sorted by key.

func (*LocalStore) Put

func (s *LocalStore) Put(_ context.Context, executionID, key string, reader io.Reader) error

Put stores an artifact on the local filesystem, computing SHA256 as it writes.

type Store

type Store interface {
	// Put stores an artifact for the given execution.
	// The reader's content is consumed and stored under the given key.
	// SHA256 checksum is computed during storage.
	Put(ctx context.Context, executionID, key string, reader io.Reader) error

	// Get retrieves an artifact by execution ID and key.
	// The caller is responsible for closing the returned ReadCloser.
	Get(ctx context.Context, executionID, key string) (io.ReadCloser, error)

	// List returns all artifacts for a given execution ID.
	List(ctx context.Context, executionID string) ([]Artifact, error)

	// Delete removes an artifact by execution ID and key.
	Delete(ctx context.Context, executionID, key string) error
}

Store defines the interface for artifact storage backends. Artifacts are scoped by execution ID and identified by key.

Jump to

Keyboard shortcuts

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