artifacts

package
v0.0.23 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OnStoresChanged

func OnStoresChanged(fn func())

OnStoresChanged sets a callback invoked when the plugin store list changes.

func RegisterPluginStore

func RegisterPluginStore(name string, s Store)

RegisterPluginStore adds a named store to the global registry. The last registered store is preferred by "auto" mode.

func Run

func Run(ctx context.Context, logger *slog.Logger, _ string) error

func UnregisterPluginStore

func UnregisterPluginStore(name string)

UnregisterPluginStore removes a store by name.

Types

type ArtifactServer

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

ArtifactServer implements the ArtifactService Connect handler.

var Server *ArtifactServer

Server is set during engine startup so the controller can swap its backend.

func NewArtifactServer

func NewArtifactServer(local *LocalStore, world pb.WorldServiceClient) *ArtifactServer

NewArtifactServer creates an ArtifactServer. store is the active backend; local is always available for read-only fallback.

func (*ArtifactServer) DeleteBlob

func (s *ArtifactServer) DeleteBlob(artID string) error

DeleteBlob deletes the blob for an artifact ID from the active store. Safe to call from any goroutine.

func (*ArtifactServer) DownloadArtifact

DownloadArtifact streams artifact data to the client.

func (*ArtifactServer) Local added in v0.0.22

func (s *ArtifactServer) Local() *LocalStore

Local returns the local filesystem store.

func (*ArtifactServer) SetAutoMode

func (s *ArtifactServer) SetAutoMode()

SetAutoMode enables auto mode: prefer last registered plugin store, fall back to local.

func (*ArtifactServer) SetStore

func (s *ArtifactServer) SetStore(store Store)

SetStore swaps the active storage backend. SetStore sets a specific backend. Disables auto mode.

func (*ArtifactServer) UploadArtifact

UploadArtifact receives artifact data from the client and stores it.

func (*ArtifactServer) WriteArtifact added in v0.0.23

func (s *ArtifactServer) WriteArtifact(ctx context.Context, entityID string, body io.Reader) error

WriteArtifact stores body as the payload of entityID's artifact component and updates the entity's sha256 and size. Shared by the gRPC UploadArtifact handler and the HTTP POST /artifacts/{id} handler.

type LocalStore

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

LocalStore stores artifact blobs as flat files on the local filesystem.

func NewLocalStore

func NewLocalStore(dataDir string) (*LocalStore, error)

NewLocalStore creates a LocalStore, creating dataDir if needed.

func (*LocalStore) Delete

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

func (*LocalStore) Exists

func (s *LocalStore) Exists(_ context.Context, id string) (bool, error)

func (*LocalStore) Get

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

func (*LocalStore) Open added in v0.0.23

func (s *LocalStore) Open(_ context.Context, id string) (*os.File, error)

Open returns the underlying file for the artifact. The returned *os.File implements io.ReaderAt and exposes Stat() for size lookup, which is needed by consumers like archive/zip that require random access.

func (*LocalStore) Put

func (s *LocalStore) Put(_ context.Context, id string, r io.Reader) error

type NamedStore

type NamedStore struct {
	Name  string
	Store Store
}

NamedStore pairs a Store with a human-readable name.

func LastPluginStore

func LastPluginStore() (NamedStore, bool)

LastPluginStore returns the most recently registered plugin store.

func PluginStores

func PluginStores() []NamedStore

PluginStores returns a snapshot of all registered plugin stores.

type Store

type Store interface {
	Get(ctx context.Context, id string) (io.ReadCloser, error)
	Put(ctx context.Context, id string, r io.Reader) error
	Delete(ctx context.Context, id string) error
	Exists(ctx context.Context, id string) (bool, error)
}

Store abstracts blob storage for artifacts.

func GetPluginStore

func GetPluginStore(name string) (Store, bool)

GetPluginStore returns a specific plugin store by name.

Jump to

Keyboard shortcuts

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