Documentation
¶
Index ¶
- Variables
- type Event
- type EventBus
- type EventHandler
- type EventType
- type Manager
- type ManagerConfig
- type PluginInfo
- type PluginRegistry
- func (r *PluginRegistry) FindByCapability(ctx context.Context, capability string) []*PluginInfo
- func (r *PluginRegistry) Get(ctx context.Context, pluginID string) (*PluginInfo, error)
- func (r *PluginRegistry) List(ctx context.Context) []*PluginInfo
- func (r *PluginRegistry) Register(ctx context.Context, info *PluginInfo) error
- func (r *PluginRegistry) Unregister(ctx context.Context, pluginID string) error
- func (r *PluginRegistry) UpdateStatus(ctx context.Context, pluginID string, status PluginStatus) error
- type PluginStatus
- type StateEntry
- type StateStore
- func (s *StateStore) Clean(ctx context.Context) (int, error)
- func (s *StateStore) Delete(ctx context.Context, key string) error
- func (s *StateStore) Get(ctx context.Context, key string) (*StateEntry, error)
- func (s *StateStore) List(ctx context.Context) []*StateEntry
- func (s *StateStore) ListByPlugin(ctx context.Context, pluginID string) []*StateEntry
- func (s *StateStore) Set(ctx context.Context, key string, value map[string]interface{}, pluginID string, ...) error
Constants ¶
This section is empty.
Variables ¶
var ( ErrStateNotFound = errors.New("state not found") ErrStateExpired = errors.New("state has expired") )
Functions ¶
This section is empty.
Types ¶
type Event ¶
type Event struct {
Type EventType `json:"type"`
PluginID string `json:"plugin_id"`
Timestamp time.Time `json:"timestamp"`
Data map[string]interface{} `json:"data"`
}
Event represents an event that can be published to the event bus
type EventBus ¶
type EventBus struct {
// contains filtered or unexported fields
}
EventBus manages event publishing and subscription
func NewEventBus ¶
NewEventBus creates a new event bus
func (*EventBus) Subscribe ¶
func (b *EventBus) Subscribe(eventType EventType, handler EventHandler)
Subscribe registers a handler for specific event type
func (*EventBus) SubscribeAll ¶
func (b *EventBus) SubscribeAll(handler EventHandler)
SubscribeAll registers a handler for all event types
type EventHandler ¶
EventHandler is a function that handles events
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager manages all inter-plugin communication
func NewManager ¶
func NewManager(config *ManagerConfig) (*Manager, error)
NewManager creates a new communication manager
func (*Manager) PluginRegistry ¶
func (m *Manager) PluginRegistry() *PluginRegistry
PluginRegistry returns the plugin registry
func (*Manager) StateStore ¶
func (m *Manager) StateStore() *StateStore
StateStore returns the state store
type ManagerConfig ¶
ManagerConfig holds configuration for the communication manager
type PluginInfo ¶
type PluginInfo struct {
ID string `json:"id"`
Name string `json:"name"`
Version string `json:"version"`
Capabilities []string `json:"capabilities"`
Metadata map[string]interface{} `json:"metadata"`
Status PluginStatus `json:"status"`
}
PluginInfo represents information about a registered plugin
type PluginRegistry ¶
type PluginRegistry struct {
// contains filtered or unexported fields
}
PluginRegistry manages plugin registration and discovery
func NewPluginRegistry ¶
func NewPluginRegistry(storeDir string, logger hclog.Logger) (*PluginRegistry, error)
NewPluginRegistry creates a new plugin registry
func (*PluginRegistry) FindByCapability ¶
func (r *PluginRegistry) FindByCapability(ctx context.Context, capability string) []*PluginInfo
FindByCapability returns all plugins with a specific capability
func (*PluginRegistry) Get ¶
func (r *PluginRegistry) Get(ctx context.Context, pluginID string) (*PluginInfo, error)
Get retrieves plugin information by ID
func (*PluginRegistry) List ¶
func (r *PluginRegistry) List(ctx context.Context) []*PluginInfo
List returns all registered plugins
func (*PluginRegistry) Register ¶
func (r *PluginRegistry) Register(ctx context.Context, info *PluginInfo) error
Register registers a plugin in the registry
func (*PluginRegistry) Unregister ¶
func (r *PluginRegistry) Unregister(ctx context.Context, pluginID string) error
Unregister removes a plugin from the registry
func (*PluginRegistry) UpdateStatus ¶
func (r *PluginRegistry) UpdateStatus(ctx context.Context, pluginID string, status PluginStatus) error
UpdateStatus updates the status of a plugin
type PluginStatus ¶
type PluginStatus string
PluginStatus represents the status of a plugin
const ( PluginStatusRegistered PluginStatus = "registered" PluginStatusRunning PluginStatus = "running" PluginStatusFinished PluginStatus = "finished" PluginStatusFailed PluginStatus = "failed" )
type StateEntry ¶
type StateEntry struct {
Key string `json:"key"`
Value map[string]interface{} `json:"value"`
PluginID string `json:"plugin_id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
ExpiresAt *time.Time `json:"expires_at,omitempty"`
AccessedAt time.Time `json:"accessed_at"`
AccessCount int `json:"access_count"`
}
StateEntry represents a shared state entry
type StateStore ¶
type StateStore struct {
// contains filtered or unexported fields
}
StateStore manages shared state between plugins
func NewStateStore ¶
func NewStateStore(storeDir string, logger hclog.Logger) (*StateStore, error)
NewStateStore creates a new state store
func (*StateStore) Clean ¶
func (s *StateStore) Clean(ctx context.Context) (int, error)
Clean removes expired state entries
func (*StateStore) Delete ¶
func (s *StateStore) Delete(ctx context.Context, key string) error
Delete removes a state entry
func (*StateStore) Get ¶
func (s *StateStore) Get(ctx context.Context, key string) (*StateEntry, error)
Get retrieves a state entry
func (*StateStore) List ¶
func (s *StateStore) List(ctx context.Context) []*StateEntry
List returns all state entries
func (*StateStore) ListByPlugin ¶
func (s *StateStore) ListByPlugin(ctx context.Context, pluginID string) []*StateEntry
ListByPlugin returns all state entries for a specific plugin