artifact

package
v0.0.0-...-dac86b4 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2026 License: MIT Imports: 12 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 S3Store

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

S3Store implements Store using an S3-compatible backend. Objects are stored under {prefix}/artifacts/{executionID}/{key}.

func NewS3Store

func NewS3Store(client *s3.Client, bucket, prefix string) *S3Store

NewS3Store creates a new S3Store.

func (*S3Store) Delete

func (s *S3Store) Delete(ctx context.Context, executionID, key string) error

Delete removes an artifact from S3.

func (*S3Store) Get

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

Get retrieves an artifact from S3.

func (*S3Store) List

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

List returns all artifacts for a given execution ID by listing S3 objects under the execution prefix.

func (*S3Store) Put

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

Put uploads an artifact to S3. The reader content is buffered to compute the SHA256 checksum before upload, since S3 PutObject requires a seekable body or known content length for checksum metadata.

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