Documentation
¶
Index ¶
- func OnStoresChanged(fn func())
- func RegisterPluginStore(name string, s Store)
- func Run(ctx context.Context, logger *slog.Logger, _ string) error
- func UnregisterPluginStore(name string)
- type ArtifactServer
- func (s *ArtifactServer) DeleteBlob(artID string) error
- func (s *ArtifactServer) DownloadArtifact(ctx context.Context, req *connect.Request[pb.DownloadArtifactRequest], ...) error
- func (s *ArtifactServer) SetAutoMode()
- func (s *ArtifactServer) SetStore(store Store)
- func (s *ArtifactServer) UploadArtifact(ctx context.Context, stream *connect.ClientStream[pb.UploadArtifactRequest]) (*connect.Response[pb.UploadArtifactResponse], error)
- type LocalStore
- type NamedStore
- type Store
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 ¶
RegisterPluginStore adds a named store to the global registry. The last registered store is preferred by "auto" mode.
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 ¶
func (s *ArtifactServer) DownloadArtifact( ctx context.Context, req *connect.Request[pb.DownloadArtifactRequest], stream *connect.ServerStream[pb.DownloadArtifactResponse], ) error
DownloadArtifact streams artifact data to the client.
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 ¶
func (s *ArtifactServer) UploadArtifact( ctx context.Context, stream *connect.ClientStream[pb.UploadArtifactRequest], ) (*connect.Response[pb.UploadArtifactResponse], error)
UploadArtifact receives artifact data from the client and stores it.
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) Get ¶
func (s *LocalStore) Get(_ context.Context, id string) (io.ReadCloser, error)
type NamedStore ¶
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 ¶
GetPluginStore returns a specific plugin store by name.