Documentation
¶
Index ¶
- type Config
- type ExecuteRequest
- type ExecuteResponse
- type Executor
- type ExecutorCapability
- type ExecutorInfo
- type ResourceInfo
- type Server
- type Store
- func (s *Store) Close() error
- func (s *Store) CreateExecutor(ctx context.Context, executor Executor, tunnelToken, registryToken string) error
- func (s *Store) GetExecutor(ctx context.Context, id string) (*ExecutorInfo, error)
- func (s *Store) ListExecutors(ctx context.Context, workspaceID string) ([]ExecutorInfo, error)
- func (s *Store) UpdateCapabilities(ctx context.Context, executorID string, cap ExecutorCapability) error
- func (s *Store) UpdateExecutorStatus(ctx context.Context, executorID, status string) error
- func (s *Store) UpdateHeartbeat(ctx context.Context, executorID string, systemInfo json.RawMessage) error
- func (s *Store) ValidateRegistryToken(ctx context.Context, executorID, token string) (bool, error)
- func (s *Store) ValidateTunnelToken(ctx context.Context, executorID, token string) (bool, error)
- type TunnelRegistry
- func (tr *TunnelRegistry) ExecViaTunnel(executorID string, httpReq *http.Request) (ExecuteResponse, error)
- func (tr *TunnelRegistry) Get(executorID string) (*yamux.Session, bool)
- func (tr *TunnelRegistry) Register(executorID string, session *yamux.Session)
- func (tr *TunnelRegistry) Unregister(executorID string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
func LoadConfigFromEnv ¶
type ExecuteRequest ¶
type ExecuteRequest struct {
ExecutorID string `json:"executor_id"`
Tool string `json:"tool"`
Arguments json.RawMessage `json:"arguments"`
TimeoutMs int `json:"timeout_ms,omitempty"`
}
type ExecuteResponse ¶
type ExecutorCapability ¶
type ExecutorCapability struct {
ExecutorID string `json:"executor_id"`
Tools []string `json:"tools"`
Environment map[string]string `json:"environment"`
Resources ResourceInfo `json:"resources"`
Description string `json:"description"`
WorkingDir string `json:"working_dir"`
ProbedAt *time.Time `json:"probed_at,omitempty"`
}
type ExecutorInfo ¶
type ExecutorInfo struct {
Executor
Capabilities ExecutorCapability `json:"capabilities"`
LastSeen *time.Time `json:"last_seen,omitempty"`
}
type ResourceInfo ¶
type Store ¶
Store provides database access for the executor registry.
func (*Store) CreateExecutor ¶
func (s *Store) CreateExecutor(ctx context.Context, executor Executor, tunnelToken, registryToken string) error
CreateExecutor inserts an executor and its associated capabilities and heartbeat rows.
func (*Store) GetExecutor ¶
GetExecutor retrieves a single executor by ID. Returns nil if not found.
func (*Store) ListExecutors ¶
ListExecutors returns all executors in a workspace with their capabilities and last heartbeat.
func (*Store) UpdateCapabilities ¶
func (s *Store) UpdateCapabilities(ctx context.Context, executorID string, cap ExecutorCapability) error
UpdateCapabilities updates the capability fields for an executor.
func (*Store) UpdateExecutorStatus ¶
UpdateExecutorStatus updates the status of an executor.
func (*Store) UpdateHeartbeat ¶
func (s *Store) UpdateHeartbeat(ctx context.Context, executorID string, systemInfo json.RawMessage) error
UpdateHeartbeat updates the last_seen timestamp and system_info for an executor.
func (*Store) ValidateRegistryToken ¶
ValidateRegistryToken checks whether the given registry token matches the stored hash.
type TunnelRegistry ¶
type TunnelRegistry struct {
// contains filtered or unexported fields
}
TunnelRegistry is an in-memory registry mapping executor_id to yamux.Session.
func NewTunnelRegistry ¶
func NewTunnelRegistry() *TunnelRegistry
NewTunnelRegistry creates a new TunnelRegistry.
func (*TunnelRegistry) ExecViaTunnel ¶
func (tr *TunnelRegistry) ExecViaTunnel(executorID string, httpReq *http.Request) (ExecuteResponse, error)
ExecViaTunnel opens a yamux stream to the specified executor, writes the given HTTP request over it, reads back the HTTP response, decodes it into an ExecuteResponse, and closes the stream before returning.
func (*TunnelRegistry) Get ¶
func (tr *TunnelRegistry) Get(executorID string) (*yamux.Session, bool)
Get returns the yamux session for the given executor, if one exists.
func (*TunnelRegistry) Register ¶
func (tr *TunnelRegistry) Register(executorID string, session *yamux.Session)
Register adds a yamux session for the given executor. If a session already exists for the executor, the old session is closed before registering the new one.
func (*TunnelRegistry) Unregister ¶
func (tr *TunnelRegistry) Unregister(executorID string)
Unregister closes and removes the yamux session for the given executor.