Documentation
¶
Index ¶
- Constants
- Variables
- func BridgeFactories(r *Registry) []controller.Factory
- func NewNoopTarget() *forge_target.Target
- func ProcessExecution(ctx context.Context, le *logrus.Entry, ws world.WorldState, registry *Registry, ...) error
- func RegisterExportZip(r *Registry)
- func RegisterFileHash(r *Registry)
- func RegisterGitClone(r *Registry)
- func RegisterKvtx(r *Registry)
- func RegisterNoop(r *Registry)
- func RegisterUnixfsRead(r *Registry)
- type BridgeFactory
- type Handler
- func NewExportZipHandler(ctx context.Context, le *logrus.Entry, ws world.WorldState, ...) (Handler, error)
- func NewFileHashHandler(ctx context.Context, le *logrus.Entry, ws world.WorldState, ...) (Handler, error)
- func NewGitCloneHandler(ctx context.Context, le *logrus.Entry, ws world.WorldState, ...) (Handler, error)
- func NewKvtxHandler(ctx context.Context, le *logrus.Entry, ws world.WorldState, ...) (Handler, error)
- func NewNoopHandler(ctx context.Context, le *logrus.Entry, ws world.WorldState, ...) (Handler, error)
- func NewUnixfsReadHandler(ctx context.Context, le *logrus.Entry, ws world.WorldState, ...) (Handler, error)
- type HandlerFactory
- type Registry
- type SpaceExecConfig
- func (c *SpaceExecConfig) EqualsConfig(other config.Config) bool
- func (c *SpaceExecConfig) GetConfigID() string
- func (c *SpaceExecConfig) MarshalBlock() ([]byte, error)
- func (c *SpaceExecConfig) MarshalJSON() ([]byte, error)
- func (c *SpaceExecConfig) MarshalToSizedBufferVT(buf []byte) (int, error)
- func (c *SpaceExecConfig) MarshalVT() ([]byte, error)
- func (c *SpaceExecConfig) Reset()
- func (c *SpaceExecConfig) SizeVT() int
- func (c *SpaceExecConfig) UnmarshalBlock(data []byte) error
- func (c *SpaceExecConfig) UnmarshalJSON(data []byte) error
- func (c *SpaceExecConfig) UnmarshalVT(data []byte) error
- func (c *SpaceExecConfig) Validate() error
Constants ¶
const ExportZipConfigID = "space-exec/export-zip"
ExportZipConfigID is the config ID for the export-zip handler.
const FileHashConfigID = "space-exec/file-hash"
FileHashConfigID is the config ID for the file-hash handler.
const NoopConfigID = "space-exec/noop"
NoopConfigID is the config ID for the noop handler.
const UnixfsReadConfigID = "space-exec/unixfs-read"
UnixfsReadConfigID is the config ID for the unixfs-read handler.
Variables ¶
var ErrUnknownConfigID = errors.New("unknown exec handler config ID")
ErrUnknownConfigID is returned when the config ID has no registered handler.
var GitCloneConfigID = forge_lib_git_clone.ConfigID
GitCloneConfigID is the config ID for the space-aware git clone handler. Matches the existing forge/lib/git/clone ConfigID so existing task targets work.
var KvtxConfigID = forge_lib_kvtx.ConfigID
KvtxConfigID is the config ID for the space-aware kvtx handler. Matches the existing forge/lib/kvtx ConfigID so existing task targets work.
Functions ¶
func BridgeFactories ¶
func BridgeFactories(r *Registry) []controller.Factory
BridgeFactories returns bus-compatible controller factories for all handlers in the registry. Each handler gets a BridgeFactory that responds to LoadConfigConstructorByID and LoadFactoryByConfig on the bus, making all space-exec handlers discoverable through the standard forge execution controller dispatch. Other plugins can contribute additional handlers by registering their own controller factories on the bus.
func NewNoopTarget ¶
func NewNoopTarget() *forge_target.Target
NewNoopTarget returns a Forge target that runs through the noop bridge.
func ProcessExecution ¶
func ProcessExecution( ctx context.Context, le *logrus.Entry, ws world.WorldState, registry *Registry, objectKey string, peerID peer.ID, ) error
ProcessExecution reads an execution object from world state and runs the target exec handler through the SpaceExecRegistry. Manages the full lifecycle: PENDING -> RUNNING -> COMPLETE/FAILED.
Returns nil when the execution completes (success or failure recorded). Returns an error if the execution cannot be processed (object missing, etc.).
func RegisterExportZip ¶
func RegisterExportZip(r *Registry)
RegisterExportZip registers the export-zip handler in the registry.
func RegisterFileHash ¶
func RegisterFileHash(r *Registry)
RegisterFileHash registers the file-hash handler in the registry.
func RegisterGitClone ¶
func RegisterGitClone(r *Registry)
RegisterGitClone registers the git clone handler in the registry.
func RegisterKvtx ¶
func RegisterKvtx(r *Registry)
RegisterKvtx registers the kvtx handler in the registry.
func RegisterNoop ¶
func RegisterNoop(r *Registry)
RegisterNoop registers the noop handler in the registry.
func RegisterUnixfsRead ¶
func RegisterUnixfsRead(r *Registry)
RegisterUnixfsRead registers the unixfs-read handler in the registry.
Types ¶
type BridgeFactory ¶
type BridgeFactory struct {
// contains filtered or unexported fields
}
BridgeFactory creates a bus-compatible controller factory from a SpaceExecRegistry handler. This adapts space-aware handlers (no bus.Bus access) to work within the existing forge execution controller dispatch.
The forge execution controller resolves config IDs through the bus:
- LoadConfigConstructorByID finds this factory (via static resolver)
- ConstructConfig returns a SpaceExecConfig that stores raw config bytes
- LoadFactoryByConfig finds this factory again
- Construct creates a bridgeController delegating to the SpaceExecRegistry
This makes all space-exec handlers discoverable through the standard bus mechanism, so other plugins can also register handlers by adding their own controller factories.
func NewBridgeFactory ¶
func NewBridgeFactory(configID string, registry *Registry) *BridgeFactory
NewBridgeFactory creates a bridge factory for the given config ID.
func (*BridgeFactory) Construct ¶
func (f *BridgeFactory) Construct( ctx context.Context, conf config.Config, opts controller.ConstructOpts, ) (controller.Controller, error)
Construct creates a bridge controller that delegates to SpaceExecRegistry.
func (*BridgeFactory) ConstructConfig ¶
func (f *BridgeFactory) ConstructConfig() config.Config
ConstructConfig returns a SpaceExecConfig that stores raw config bytes. The forge execution controller's Resolve path calls this, then unmarshals the target's config data into the returned object.
func (*BridgeFactory) GetConfigID ¶
func (f *BridgeFactory) GetConfigID() string
GetConfigID returns the config ID this factory handles.
func (*BridgeFactory) GetVersion ¶
func (f *BridgeFactory) GetVersion() semver.Version
GetVersion returns the bridge factory version.
type Handler ¶
type Handler interface {
// Execute runs the handler to completion.
Execute(ctx context.Context) error
}
Handler executes a single forge task within the space context. Receives inputs, performs work via the handle, sets outputs, returns. Returning nil signals successful completion. Returning an error signals failure.
func NewExportZipHandler ¶
func NewExportZipHandler( ctx context.Context, le *logrus.Entry, ws world.WorldState, handle forge_target.ExecControllerHandle, inputs forge_target.InputMap, configData []byte, ) (Handler, error)
NewExportZipHandler constructs an export-zip space handler.
func NewFileHashHandler ¶
func NewFileHashHandler( ctx context.Context, le *logrus.Entry, ws world.WorldState, handle forge_target.ExecControllerHandle, inputs forge_target.InputMap, configData []byte, ) (Handler, error)
NewFileHashHandler constructs a file-hash space handler.
func NewGitCloneHandler ¶
func NewGitCloneHandler( ctx context.Context, le *logrus.Entry, ws world.WorldState, handle forge_target.ExecControllerHandle, inputs forge_target.InputMap, configData []byte, ) (Handler, error)
NewGitCloneHandler constructs a git clone space handler. Deserializes configData as the forge/lib/git/clone Config proto and executes the clone using world state directly (no bus access).
func NewKvtxHandler ¶
func NewKvtxHandler( ctx context.Context, le *logrus.Entry, ws world.WorldState, handle forge_target.ExecControllerHandle, inputs forge_target.InputMap, configData []byte, ) (Handler, error)
NewKvtxHandler constructs a kvtx space handler. Deserializes configData as the kvtx Config proto, constructs the controller with a nil bus (unused by kvtx), and initializes it with inputs and handle.
func NewNoopHandler ¶
func NewNoopHandler( ctx context.Context, le *logrus.Entry, ws world.WorldState, handle forge_target.ExecControllerHandle, inputs forge_target.InputMap, configData []byte, ) (Handler, error)
NewNoopHandler constructs a noop handler.
func NewUnixfsReadHandler ¶
func NewUnixfsReadHandler( ctx context.Context, le *logrus.Entry, ws world.WorldState, handle forge_target.ExecControllerHandle, inputs forge_target.InputMap, configData []byte, ) (Handler, error)
NewUnixfsReadHandler constructs a unixfs-read space handler.
type HandlerFactory ¶
type HandlerFactory func( ctx context.Context, le *logrus.Entry, ws world.WorldState, handle forge_target.ExecControllerHandle, inputs forge_target.InputMap, configData []byte, ) (Handler, error)
HandlerFactory constructs a Handler for a given exec config ID. No bus.Bus parameter: handlers access only the world state and exec handle.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry maps exec config IDs to handler factories.
func NewDefaultRegistry ¶
func NewDefaultRegistry() *Registry
NewDefaultRegistry creates a registry with all built-in space exec handlers.
func (*Registry) CreateHandler ¶
func (r *Registry) CreateHandler( ctx context.Context, le *logrus.Entry, ws world.WorldState, handle forge_target.ExecControllerHandle, inputs forge_target.InputMap, configID string, configData []byte, ) (Handler, error)
CreateHandler looks up and constructs a handler for the given config ID.
func (*Registry) Lookup ¶
func (r *Registry) Lookup(configID string) HandlerFactory
Lookup returns the factory for the given config ID, or nil if not found.
func (*Registry) Register ¶
func (r *Registry) Register(configID string, factory HandlerFactory)
Register adds a handler factory for the given config ID.
type SpaceExecConfig ¶
type SpaceExecConfig struct {
// contains filtered or unexported fields
}
SpaceExecConfig is a generic config type for space-exec handlers. It wraps raw config data bytes and a config ID, satisfying the config.Config, protobuf_go_lite.Message, and block.Block interfaces.
The actual config deserialization happens inside each HandlerFactory, so this type just carries the raw bytes through the controllerbus config resolution pipeline (LoadConfigConstructorByID -> Resolve -> LoadFactoryByConfig -> Construct).
func NewSpaceExecConfig ¶
func NewSpaceExecConfig(configID string) *SpaceExecConfig
NewSpaceExecConfig constructs a SpaceExecConfig with the given config ID.
func (*SpaceExecConfig) EqualsConfig ¶
func (c *SpaceExecConfig) EqualsConfig(other config.Config) bool
EqualsConfig checks equality by config ID and data.
func (*SpaceExecConfig) GetConfigID ¶
func (c *SpaceExecConfig) GetConfigID() string
GetConfigID returns the config ID.
func (*SpaceExecConfig) MarshalBlock ¶
func (c *SpaceExecConfig) MarshalBlock() ([]byte, error)
MarshalBlock returns the raw data for block storage.
func (*SpaceExecConfig) MarshalJSON ¶
func (c *SpaceExecConfig) MarshalJSON() ([]byte, error)
MarshalJSON returns the raw data (assumed JSON or empty).
func (*SpaceExecConfig) MarshalToSizedBufferVT ¶
func (c *SpaceExecConfig) MarshalToSizedBufferVT(buf []byte) (int, error)
MarshalToSizedBufferVT marshals to a pre-allocated buffer.
func (*SpaceExecConfig) MarshalVT ¶
func (c *SpaceExecConfig) MarshalVT() ([]byte, error)
MarshalVT returns the raw data.
func (*SpaceExecConfig) SizeVT ¶
func (c *SpaceExecConfig) SizeVT() int
SizeVT returns the size of the data.
func (*SpaceExecConfig) UnmarshalBlock ¶
func (c *SpaceExecConfig) UnmarshalBlock(data []byte) error
UnmarshalBlock stores the raw block data.
func (*SpaceExecConfig) UnmarshalJSON ¶
func (c *SpaceExecConfig) UnmarshalJSON(data []byte) error
UnmarshalJSON stores the raw JSON bytes.
func (*SpaceExecConfig) UnmarshalVT ¶
func (c *SpaceExecConfig) UnmarshalVT(data []byte) error
UnmarshalVT stores the raw protobuf bytes.
func (*SpaceExecConfig) Validate ¶
func (c *SpaceExecConfig) Validate() error
Validate returns nil; validation happens in the handler factory.