plugin

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultPriority = 100

Variables

View Source
var (
	ErrHookNotFound          = errors.New("hook not found")
	ErrHookExecutionFailed   = errors.New("hook execution failed")
	ErrHookAlreadyRegistered = errors.New("hook already registered")
)
View Source
var (
	ErrPluginNotFound      = errors.New("plugin not found")
	ErrPluginInvalidFormat = errors.New("invalid WASM format")
	ErrPluginLoadFailed    = errors.New("plugin load failed")
)

Functions

This section is empty.

Types

type FailureMode

type FailureMode int
const (
	FailFast FailureMode = iota
	LogAndContinue
	Fallback
)
const DefaultFailureMode FailureMode = FailFast

func ParseFailureMode

func ParseFailureMode(s string) FailureMode

func (FailureMode) String

func (f FailureMode) String() string

type HookHandler

type HookHandler func(ctx context.Context, data []byte) ([]byte, error)

type HookName

type HookName string
const (
	HookBeforeSave     HookName = "BeforeSaveContent"
	HookAfterPublish   HookName = "AfterPublishContent"
	HookBeforeDelete   HookName = "BeforeDeleteContent"
	HookAfterCreate    HookName = "AfterCreateContent"
	HookOnPluginLoaded HookName = "OnPluginLoaded"
)

func ResolveWasmHookName

func ResolveWasmHookName(exportSuffix string) HookName

func (HookName) String

func (h HookName) String() string

type HookRegistration

type HookRegistration struct {
	PluginName      string
	HookName        HookName
	Priority        int
	Handler         HookHandler
	FailureMode     FailureMode
	FallbackHandler HookHandler
}

type Plugin

type Plugin struct {
	Name     string
	FilePath string
	Module   api.Module
	Status   Status
	LoadedAt time.Time
}

type Status

type Status string
const (
	StatusLoaded   Status = "loaded"
	StatusFailed   Status = "failed"
	StatusUnloaded Status = "unloaded"
)

func (Status) String

func (s Status) String() string

Jump to

Keyboard shortcuts

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