plugin

package
v1.26.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 20, 2026 License: MPL-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// max compressed plugin archive size accepted from uploads or URL fetches
	MaxArchiveSizeBytes int64 = 50 * 1024 * 1024 // 50 MiB
	// max manifest.json size read from a plugin archive
	MaxManifestSizeBytes int64 = 1 * 1024 * 1024 // 1 MiB

	// extraction guardrails for supervised runtime archive unpacking
	MaxArchiveExtractFileBytes  uint64 = 50 * 1024 * 1024  // 50 MiB per file
	MaxArchiveExtractTotalBytes uint64 = 200 * 1024 * 1024 // 200 MiB total
	MaxArchiveExtractFileCount  int    = 2048
)
View Source
const ArchiveManifestFileName = "manifest.json"
View Source
const PluginDirectory = "plugins"

Variables

View Source
var (
	ActiveStateActive   = ActiveState{activeStateActive}
	ActiveStateInactive = ActiveState{activeStateInactive}
)
View Source
var (
	PluginModeSupervised = PluginMode{pluginModeSupervised}
	PluginModeExternal   = PluginMode{pluginModeExternal}
)
View Source
var (
	ReportedStateInactive   = ReportedState{reportedStateInactive}
	ReportedStateStarting   = ReportedState{reportedStateStarting}
	ReportedStateConnecting = ReportedState{reportedStateConnecting}
	ReportedStateActive     = ReportedState{reportedStateActive}
	ReportedStateStopping   = ReportedState{reportedStateStopping}
	ReportedStateError      = ReportedState{reportedStateError}
	ReportedStateRestarting = ReportedState{reportedStateRestarting}
)

Functions

This section is empty.

Types

type ActiveState

type ActiveState struct {
	// contains filtered or unexported fields
}

func NewActiveState

func NewActiveState(__iNpUt__ string) (ActiveState, error)

func (ActiveState) Format

func (r ActiveState) Format(f fmt.State, verb rune)

func (ActiveState) MarshalText

func (r ActiveState) MarshalText() ([]byte, error)

func (*ActiveState) Scan

func (r *ActiveState) Scan(__iNpUt__ any) error

func (ActiveState) String

func (r ActiveState) String() string

func (*ActiveState) UnmarshalText

func (r *ActiveState) UnmarshalText(__iNpUt__ []byte) error

func (ActiveState) Value

func (r ActiveState) Value() (driver.Value, error)

type Available

type Available struct {
	Record Record
	Loaded *Validated
}

Available represents a plugin that has been installed and registered in the database and is ready to use.

type Binary

type Binary []byte

func (Binary) Validate

func (b Binary) Validate(ctx context.Context) (*Validated, error)

type InstallationID

type InstallationID xid.ID

func (InstallationID) String

func (id InstallationID) String() string

type Loaded

type Loaded struct {
	Record Record
	State  ActiveState
}

type PluginMode

type PluginMode struct {
	// contains filtered or unexported fields
}

func NewPluginMode

func NewPluginMode(__iNpUt__ string) (PluginMode, error)

func (PluginMode) External

func (m PluginMode) External() bool

func (PluginMode) Format

func (r PluginMode) Format(f fmt.State, verb rune)

func (PluginMode) MarshalText

func (r PluginMode) MarshalText() ([]byte, error)

func (*PluginMode) Scan

func (r *PluginMode) Scan(__iNpUt__ any) error

func (PluginMode) String

func (r PluginMode) String() string

func (PluginMode) Supervised

func (m PluginMode) Supervised() bool

func (*PluginMode) UnmarshalText

func (r *PluginMode) UnmarshalText(__iNpUt__ []byte) error

func (PluginMode) Value

func (r PluginMode) Value() (driver.Value, error)

type Record

type Record struct {
	InstallationID InstallationID
	Created        time.Time
	AddedBy        account.AccountID
	Manifest       rpc.Manifest
	Config         map[string]any
	Token          string
	Mode           PluginMode

	// Supervised tells the host whether the plugin is a process owned by the
	// process. When it is, the host will start the process and monitor it. If
	// false, the plugin is an "external" plugin and not run as a child process.
	Supervised bool

	State          ActiveState
	StateChangedAt time.Time
	StatusMessage  string
	Details        map[string]any

	ReportedState ReportedState
	StartedAt     time.Time
}

Record represents the database record for a plugin. It's the source of truth for plugins in general, it stores a copy of the manifest, who added it and the file path for the plugin's packaged binary application.

func MapRecord

func MapRecord(in *ent.Plugin) (*Record, error)

type ReportedState

type ReportedState struct {
	// contains filtered or unexported fields
}

func NewReportedState

func NewReportedState(__iNpUt__ string) (ReportedState, error)

func (ReportedState) Format

func (r ReportedState) Format(f fmt.State, verb rune)

func (ReportedState) MarshalText

func (r ReportedState) MarshalText() ([]byte, error)

func (*ReportedState) Scan

func (r *ReportedState) Scan(__iNpUt__ any) error

func (ReportedState) String

func (r ReportedState) String() string

func (*ReportedState) UnmarshalText

func (r *ReportedState) UnmarshalText(__iNpUt__ []byte) error

func (ReportedState) Value

func (r ReportedState) Value() (driver.Value, error)

type Validated

type Validated struct {
	Metadata rpc.Manifest
	Binary   []byte
}

Validated represents a plugin that has been read and validated from its binary.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL