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) Local() *LocalStore
- 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)
- func (s *ArtifactServer) WriteArtifact(ctx context.Context, entityID string, body io.Reader) (string, error)
- type LocalStore
- func (s *LocalStore) Delete(_ context.Context, id string) error
- func (s *LocalStore) Exists(_ context.Context, id string) (bool, error)
- func (s *LocalStore) Get(_ context.Context, id string) (io.ReadCloser, error)
- func (s *LocalStore) Open(_ context.Context, id string) (*os.File, error)
- func (s *LocalStore) Path(id string) string
- func (s *LocalStore) Put(_ context.Context, id string, r io.Reader) error
- 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) 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 ¶
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.
func (*ArtifactServer) WriteArtifact ¶ added in v0.0.23
func (s *ArtifactServer) WriteArtifact(ctx context.Context, entityID string, body io.Reader) (string, error)
WriteArtifact stores body as the payload of entityID's artifact component and updates the entity's sha256 and size, returning the content type. 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) Get ¶
func (s *LocalStore) Get(_ context.Context, id string) (io.ReadCloser, error)
func (*LocalStore) Open ¶ added in v0.0.23
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) Path ¶ added in v1.0.0
func (s *LocalStore) Path(id string) string
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.