Documentation
¶
Overview ¶
FOR DB QUERIES
Index ¶
- func AddInstalledPluginToDB(pluginDetailsID int, marketplacePluginID *int, userID int, ...) (int, error)
- func AddMarketplacePluginToDB(pluginDetailsID int, featured bool, verified bool, priceType string, ...) error
- func AddPluginFeedbackToDB(marketplacePluginID, userID, rating int, comment string, suggessions string) error
- func AddPluginToDB(name string, version string, description string, authorID int, website string, ...) (int, error)
- func BuildPluginKey(pluginName, author, version string) (string, error)
- func CheckInstalledPluginWithID(pluginID int) (bool, error)
- func CheckInstalledPluginWithInfo(pluginName, pluginVersion string, userID int) (bool, error)
- func CheckPluginDetailsExist(pluginName, pluginVersion, pluginDescription string, authorID int, ...) (bool, error)
- func CheckPluginDetailsExistByID(pluginID int) (bool, error)
- func CheckPluginDetailsExistByNameAuthorVersion(pluginName string, authorID int, pluginVersion string) (bool, error)
- func DeletePluginDetailsByID(pluginID int) error
- func ExtractPluginPathID(s string) (int, error)
- func GetAllMarketplacePlugins() ([]*models.MarketplacePlugin, error)
- func GetInstalledPluginId(pluginName, pluginVersion, pluginDescription string, authorID int, userID int) (int, error)
- func GetMarketplacePluginByID(pluginID int) (*models.MarketplacePlugin, error)
- func GetMarketplacePluginID(pluginDetailsID int) (int, error)
- func GetPluginDetailsByID(pluginID int) (*models.PluginDetails, error)
- func GetPluginDetailsID(pluginName, pluginVersion, pluginDescription string, authorID int) (int, error)
- func GetPluginFeedback(marketplacePluginID int) ([]models.PluginFeedback, error)
- func GetPluginIDByNameAuthorVersion(pluginName string, authorID int, pluginVersion string) (int, error)
- func GetPluginIdDB(pluginName, pluginVersion, pluginDescription string) (int, error)
- func GetPluginStatusDB(pluginID int) (string, error)
- func IncrementPluginDownloads(pluginDetailsID int) error
- func UninstallAllPluginFromDB(pluginID int) error
- func UninstallPluginFromDB(pluginID int, userID int) error
- func UpdateInstalledPluginInstalledPath(installedPluginID int, installedPath string) error
- func UpdatePluginStatusDB(pluginID int, status string, userID int) error
- func UpdateRating(pluginDetailsID int, ratingAvg float32, ratingCnt int) error
- type APIBridge
- func (ab *APIBridge) DeserializeRequest(data []byte) (*APIRequest, error)
- func (ab *APIBridge) DeserializeResponse(data []byte) (*APIResponse, error)
- func (ab *APIBridge) MakeInternalRequest(ctx context.Context, method, path string, body []byte) (*APIResponse, error)
- func (ab *APIBridge) MakeKubernetesRequest(ctx context.Context, method, path string, body []byte) (*APIResponse, error)
- func (ab *APIBridge) MakeRequest(ctx context.Context, req *APIRequest) (*APIResponse, error)
- func (ab *APIBridge) SerializeRequest(req *APIRequest) ([]byte, error)
- func (ab *APIBridge) SerializeResponse(resp *APIResponse) ([]byte, error)
- func (ab *APIBridge) ValidateRequest(req *APIRequest) error
- type APIRequest
- type APIResponse
- type Plugin
- type PluginBackendConfig
- type PluginBuildConfig
- type PluginConfigItem
- type PluginFrontendConfig
- type PluginFrontendRoute
- type PluginInfo
- type PluginLoader
- type PluginManager
- func (pm *PluginManager) DeregisterPlugin(plugin *Plugin)
- func (pm *PluginManager) DisablePlugin(pluginID int, userID int) error
- func (pm *PluginManager) EnablePlugin(pluginID int, userID int) error
- func (pm *PluginManager) GetPlugin(id int) (*Plugin, bool)
- func (pm *PluginManager) GetPluginList() []*Plugin
- func (pm *PluginManager) GetRegisteredRoutes(pluginID int) []string
- func (pm *PluginManager) IsPluginDisabled(id int) bool
- func (pm *PluginManager) LoadPlugin(pluginPath string) error
- func (pm *PluginManager) RegisterPlugin(plugin *Plugin, userIDAuth int)
- func (pm *PluginManager) UninstallAllPlugins() error
- func (pm *PluginManager) UnloadPlugin(pluginID int) error
- type PluginManifest
- type PluginMetadata
- type PluginNavigationItem
- type PluginRegistry
- func (pr *PluginRegistry) DiscoverPlugins() ([]*PluginInfo, error)
- func (pr *PluginRegistry) GetPluginInfo(name string) (*PluginInfo, error)
- func (pr *PluginRegistry) GetPluginsDirectory() string
- func (pr *PluginRegistry) LoadPlugin(name string) error
- func (pr *PluginRegistry) ReloadPlugin(pluginID int) error
- func (pr *PluginRegistry) StartWatching() error
- func (pr *PluginRegistry) StopWatching() error
- func (pr *PluginRegistry) UnloadPlugin(ID int) error
- type PluginRoute
- type PluginSpec
- type PluginValidationResult
- type PluginWasmConfig
- type PluginWatcher
- type PluginWidgetConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddInstalledPluginToDB ¶
func AddPluginFeedbackToDB ¶
func AddPluginToDB ¶
func BuildPluginKey ¶
func CheckPluginDetailsExist ¶
func DeletePluginDetailsByID ¶
func ExtractPluginPathID ¶
func GetAllMarketplacePlugins ¶
func GetAllMarketplacePlugins() ([]*models.MarketplacePlugin, error)
func GetInstalledPluginId ¶
func GetMarketplacePluginByID ¶
func GetMarketplacePluginByID(pluginID int) (*models.MarketplacePlugin, error)
func GetMarketplacePluginID ¶
func GetPluginDetailsByID ¶
func GetPluginDetailsByID(pluginID int) (*models.PluginDetails, error)
func GetPluginDetailsID ¶
func GetPluginFeedback ¶
func GetPluginFeedback(marketplacePluginID int) ([]models.PluginFeedback, error)
func GetPluginIdDB ¶
func GetPluginStatusDB ¶
func UninstallPluginFromDB ¶
func UpdatePluginStatusDB ¶
Types ¶
type APIBridge ¶
type APIBridge struct {
// contains filtered or unexported fields
}
APIBridge provides communication between plugins and external APIs
func NewAPIBridge ¶
NewAPIBridge creates a new API bridge instance
func (*APIBridge) DeserializeRequest ¶
func (ab *APIBridge) DeserializeRequest(data []byte) (*APIRequest, error)
DeserializeRequest deserializes an API request from JSON
func (*APIBridge) DeserializeResponse ¶
func (ab *APIBridge) DeserializeResponse(data []byte) (*APIResponse, error)
DeserializeResponse deserializes an API response from JSON
func (*APIBridge) MakeInternalRequest ¶
func (ab *APIBridge) MakeInternalRequest(ctx context.Context, method, path string, body []byte) (*APIResponse, error)
MakeInternalRequest makes a request to internal KubeStellar APIs
func (*APIBridge) MakeKubernetesRequest ¶
func (ab *APIBridge) MakeKubernetesRequest(ctx context.Context, method, path string, body []byte) (*APIResponse, error)
MakeKubernetesRequest makes a request to the Kubernetes API
func (*APIBridge) MakeRequest ¶
func (ab *APIBridge) MakeRequest(ctx context.Context, req *APIRequest) (*APIResponse, error)
MakeRequest executes an HTTP request on behalf of a plugin
func (*APIBridge) SerializeRequest ¶
func (ab *APIBridge) SerializeRequest(req *APIRequest) ([]byte, error)
SerializeRequest serializes an API request to JSON
func (*APIBridge) SerializeResponse ¶
func (ab *APIBridge) SerializeResponse(resp *APIResponse) ([]byte, error)
SerializeResponse serializes an API response to JSON
func (*APIBridge) ValidateRequest ¶
func (ab *APIBridge) ValidateRequest(req *APIRequest) error
ValidateRequest validates an API request before execution
type APIRequest ¶
type APIRequest struct {
Method string `json:"method"`
URL string `json:"url"`
Headers map[string]string `json:"headers,omitempty"`
Body []byte `json:"body,omitempty"`
Timeout int `json:"timeout,omitempty"` // in seconds
}
APIRequest represents a request to be made by a plugin
type APIResponse ¶
type APIResponse struct {
StatusCode int `json:"statusCode"`
Headers map[string]string `json:"headers"`
Body []byte `json:"body"`
Error string `json:"error,omitempty"`
}
APIResponse represents a response from an API call
type Plugin ¶
type Plugin struct {
ID int `json:"id"`
Manifest *PluginManifest // Plugin metadata and configuration from plugin.yml
Module wazero.CompiledModule // Compiled WASM module
Instance api.Module // Instantiated WASM module
Status string // Current status (e.g., active, inactive)
LoadTime time.Time // Timestamp when the plugin was loaded
}
Plugin represents a single loaded WASM plugin and its runtime details.
type PluginBackendConfig ¶
type PluginBackendConfig struct {
Enabled bool `yaml:"enabled" json:"enabled"` // Whether backend is enabled
Routes []PluginRoute `yaml:"routes,omitempty" json:"routes,omitempty"` // Backend API routes
}
PluginBackendConfig contains backend integration configuration
type PluginBuildConfig ¶
type PluginBuildConfig struct {
GoVersion string `yaml:"go_version" json:"go_version"` // Go version used for building
TinyGoVersion string `yaml:"tinygo_version" json:"tinygo_version"` // TinyGo version used for WASM compilation
}
PluginBuildConfig contains build information
type PluginConfigItem ¶
type PluginConfigItem struct {
Name string `yaml:"name" json:"name"` // Configuration name
Type string `yaml:"type" json:"type"` // Type (e.g., "integer", "string")
Default interface{} `yaml:"default" json:"default"` // Default value
Description string `yaml:"description" json:"description"` // Description of the configuration
}
PluginConfigItem describes a configuration option
type PluginFrontendConfig ¶
type PluginFrontendConfig struct {
Enabled bool `yaml:"enabled" json:"enabled"` // Whether frontend integration is enabled
Widgets []PluginWidgetConfig `yaml:"widgets,omitempty" json:"widgets,omitempty"` // Dashboard widgets
Routes []PluginFrontendRoute `yaml:"routes,omitempty" json:"routes,omitempty"` // Frontend routes
}
PluginFrontendConfig contains frontend integration configuration
type PluginFrontendRoute ¶
type PluginFrontendRoute struct {
Path string `yaml:"path" json:"path"` // Route path
Component string `yaml:"component" json:"component"` // React component name
Exact bool `yaml:"exact" json:"exact"` // Whether route matching should be exact
}
PluginFrontendRoute describes a frontend route definition
type PluginInfo ¶
type PluginInfo struct {
ID int `json:"id"`
Name string `json:"name"`
Version string `json:"version"`
Author string `json:"author,omitempty"`
Description string `json:"description,omitempty"`
Path string `json:"path"`
ManifestPath string `json:"manifestPath"`
WasmPath string `json:"wasmPath"`
DiscoveredAt time.Time `json:"discoveredAt"`
LastModified time.Time `json:"lastModified"`
Status string `json:"status"` // "discovered", "loaded", "error"
Error string `json:"error,omitempty"`
}
PluginInfo contains metadata about a discovered plugin
type PluginLoader ¶
type PluginLoader struct {
// contains filtered or unexported fields
}
PluginLoader handles plugin loading, validation, and integrity checking
func NewPluginLoader ¶
func NewPluginLoader(pluginsDirectory string) *PluginLoader
NewPluginLoader creates a new plugin loader
func (*PluginLoader) LoadPluginFromArchive ¶
func (pl *PluginLoader) LoadPluginFromArchive(archivePath string) (*Plugin, error)
LoadPluginFromArchive loads a plugin from a compressed archive
func (*PluginLoader) LoadPluginFromPath ¶
func (pl *PluginLoader) LoadPluginFromPath(pluginPath string) (*Plugin, error)
LoadPluginFromPath loads a plugin from a specific path
func (*PluginLoader) ValidatePlugin ¶
func (pl *PluginLoader) ValidatePlugin(pluginPath string) (*PluginValidationResult, error)
ValidatePlugin validates a plugin without loading it
type PluginManager ¶
type PluginManager struct {
// contains filtered or unexported fields
}
PluginManager handles the lifecycle, runtime, and routing of dynamically loaded plugins.
func NewPluginManager ¶
func NewPluginManager(router *gin.Engine) *PluginManager
NewPluginManager initializes a new PluginManager with wazero runtime and Gin router.
func (*PluginManager) DeregisterPlugin ¶
func (pm *PluginManager) DeregisterPlugin(plugin *Plugin)
func (*PluginManager) DisablePlugin ¶
func (pm *PluginManager) DisablePlugin(pluginID int, userID int) error
func (*PluginManager) EnablePlugin ¶
func (pm *PluginManager) EnablePlugin(pluginID int, userID int) error
func (*PluginManager) GetPlugin ¶
func (pm *PluginManager) GetPlugin(id int) (*Plugin, bool)
GetPlugin retrieves a specific plugin by name.
func (*PluginManager) GetPluginList ¶
func (pm *PluginManager) GetPluginList() []*Plugin
GetPluginList returns all registered plugins.
func (*PluginManager) GetRegisteredRoutes ¶
func (pm *PluginManager) GetRegisteredRoutes(pluginID int) []string
GetRegisteredRoutes returns the list of registered routes for a plugin
func (*PluginManager) IsPluginDisabled ¶
func (pm *PluginManager) IsPluginDisabled(id int) bool
IsPluginDisabled checks if a plugin is disabled
func (*PluginManager) LoadPlugin ¶
func (pm *PluginManager) LoadPlugin(pluginPath string) error
LoadPlugin loads and initializes a plugin from a given directory.
func (*PluginManager) RegisterPlugin ¶
func (pm *PluginManager) RegisterPlugin(plugin *Plugin, userIDAuth int)
func (*PluginManager) UninstallAllPlugins ¶
func (pm *PluginManager) UninstallAllPlugins() error
func (*PluginManager) UnloadPlugin ¶
func (pm *PluginManager) UnloadPlugin(pluginID int) error
UnloadPlugin terminates and removes a plugin from the manager.
type PluginManifest ¶
type PluginManifest struct {
APIVersion string `yaml:"apiVersion" json:"apiVersion"` // API version
Kind string `yaml:"kind" json:"kind"` // Resource kind (e.g., "Plugin")
Metadata PluginMetadata `yaml:"metadata" json:"metadata"` // Plugin metadata
Spec PluginSpec `yaml:"spec" json:"spec"` // Plugin specification
}
PluginManifest defines the plugin.yml schema for plugin configuration.
type PluginMetadata ¶
type PluginMetadata struct {
Name string `yaml:"name" json:"name"` // Unique name of the plugin
Version string `yaml:"version" json:"version"` // Plugin version
Author string `yaml:"author" json:"author"` // Plugin author
Description string `yaml:"description" json:"description"` // Plugin description
}
PluginMetadata defines the plugin metadata information
type PluginNavigationItem ¶
type PluginNavigationItem struct {
}
PluginNavigationItem describes a navigation menu item
type PluginRegistry ¶
type PluginRegistry struct {
// contains filtered or unexported fields
}
PluginRegistry handles plugin discovery, registration, and lifecycle management
func NewPluginRegistry ¶
func NewPluginRegistry(pluginsDirectory string, manager *PluginManager) *PluginRegistry
NewPluginRegistry creates a new plugin registry
func (*PluginRegistry) DiscoverPlugins ¶
func (pr *PluginRegistry) DiscoverPlugins() ([]*PluginInfo, error)
DiscoverPlugins scans the plugins directory for available plugins
func (*PluginRegistry) GetPluginInfo ¶
func (pr *PluginRegistry) GetPluginInfo(name string) (*PluginInfo, error)
GetPluginInfo returns information about a specific plugin
func (*PluginRegistry) GetPluginsDirectory ¶
func (pr *PluginRegistry) GetPluginsDirectory() string
GetPluginsDirectory returns the plugins directory path
func (*PluginRegistry) LoadPlugin ¶
func (pr *PluginRegistry) LoadPlugin(name string) error
LoadPlugin loads a plugin by name
func (*PluginRegistry) ReloadPlugin ¶
func (pr *PluginRegistry) ReloadPlugin(pluginID int) error
ReloadPlugin reloads a plugin by name
func (*PluginRegistry) StartWatching ¶
func (pr *PluginRegistry) StartWatching() error
StartWatching starts the plugin watcher for hot reloading
func (*PluginRegistry) StopWatching ¶
func (pr *PluginRegistry) StopWatching() error
StopWatching stops the plugin watcher
func (*PluginRegistry) UnloadPlugin ¶
func (pr *PluginRegistry) UnloadPlugin(ID int) error
UnloadPlugin unloads a plugin by ID
type PluginRoute ¶
type PluginRoute struct {
Path string `yaml:"path" json:"path"` // Route path (e.g., "/status")
Methods []string `yaml:"methods" json:"methods"` // HTTP methods
Handler string `yaml:"handler" json:"handler"` // Name of the WASM function to call
}
PluginRoute describes a single HTTP route exposed by a plugin.
type PluginSpec ¶
type PluginSpec struct {
Wasm *PluginWasmConfig `yaml:"wasm,omitempty" json:"wasm,omitempty"` // WASM binary configuration
Build *PluginBuildConfig `yaml:"build,omitempty" json:"build,omitempty"` // Build configuration
Backend *PluginBackendConfig `yaml:"backend,omitempty" json:"backend,omitempty"` // Backend configuration
Permissions []string `yaml:"permissions,omitempty" json:"permissions,omitempty"` // Required permissions
Frontend *PluginFrontendConfig `yaml:"frontend,omitempty" json:"frontend,omitempty"` // Frontend configuration
Configuration []PluginConfigItem `yaml:"configuration,omitempty" json:"configuration,omitempty"` // Plugin configuration options
}
PluginSpec contains the plugin specification
type PluginValidationResult ¶
type PluginValidationResult struct {
Valid bool `json:"valid"`
Errors []string `json:"errors,omitempty"`
Warnings []string `json:"warnings,omitempty"`
Checksum string `json:"checksum,omitempty"`
Size int64 `json:"size,omitempty"`
}
PluginValidationResult contains the result of plugin validation
type PluginWasmConfig ¶
type PluginWasmConfig struct {
File string `yaml:"file" json:"file"` // WASM file name
Entrypoint string `yaml:"entrypoint" json:"entrypoint"` // Main function entry point
MemoryLimit string `yaml:"memory_limit" json:"memory_limit"` // Memory limit (e.g., "64MB")
}
PluginWasmConfig contains WASM binary information
type PluginWatcher ¶
type PluginWatcher struct {
// contains filtered or unexported fields
}
PluginWatcher monitors the plugins directory for changes and automatically reloads plugins
func NewPluginWatcher ¶
func NewPluginWatcher(registry *PluginRegistry) *PluginWatcher
NewPluginWatcher creates a new plugin watcher
func (*PluginWatcher) Start ¶
func (pw *PluginWatcher) Start() error
Start begins watching the plugins directory for changes
type PluginWidgetConfig ¶
type PluginWidgetConfig struct {
Name string `yaml:"name" json:"name"` // Widget name
Title string `yaml:"title" json:"title"` // Widget title
Size string `yaml:"size" json:"size"` // Widget size (e.g., "medium")
Dashboard string `yaml:"dashboard" json:"dashboard"` // Target dashboard
Component string `yaml:"component" json:"component"` // React component name
}
PluginWidgetConfig describes a dashboard widget