Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsClientErr ¶
IsClientErr reports whether an error is a client error.
func ToRow ¶
func ToRow(w *UploadedWidget) widgetsrepo.Row
ToRow converts UploadedWidget to repository Row.
Types ¶
type Manifest ¶
type Manifest struct {
ID string `json:"id"`
Name string `json:"name"`
Version string `json:"version"`
Type string `json:"type"`
Scopes []string `json:"scopes"`
Enabled *bool `json:"enabled,omitempty"`
Description *string `json:"description,omitempty"`
Capabilities []string `json:"capabilities,omitempty"`
Homepage *string `json:"homepage,omitempty"`
Meta map[string]any `json:"meta,omitempty"`
}
Manifest represents a plugin manifest inside the uploaded archive.
func ExtractManifest ¶
ExtractManifest extracts manifest.json or plugin.json from the archive at path.
type UploadOptions ¶
UploadOptions controls how a plugin upload should be handled.
type UploadedWidget ¶
type UploadedWidget struct {
ID string
Name string
Version string
Type string
Scopes []string
Enabled bool
Description *string
Capabilities []string
Homepage *string
Meta map[string]any
TenantScope string
Tenants []string
UpdatedAt time.Time
PackageSize int64
}
UploadedWidget contains information about the stored widget.
type Uploader ¶
type Uploader struct {
Repo WidgetsRepo
Notifier WidgetsNotifier
Logger Logger
AcceptExt []string
TmpDir string
StoreDir string
}
Uploader handles plugin uploads.
func (*Uploader) HandleUpload ¶
func (u *Uploader) HandleUpload(ctx context.Context, f multipart.File, filename string, opt UploadOptions) (*UploadedWidget, error)
HandleUpload processes the uploaded plugin file and stores metadata.
type WidgetsNotifier ¶
type WidgetsNotifier interface {
NotifyWidgetChanged(ctx context.Context, id string) error
NotifyWidgetRemoved(ctx context.Context, id string) error
}
WidgetsNotifier notifies other nodes of widget changes.
type WidgetsRepo ¶
type WidgetsRepo interface {
Upsert(ctx context.Context, r widgetsrepo.Row) error
}
WidgetsRepo defines the repository for widgets.
Click to show internal directories.
Click to hide internal directories.