Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Plugin ¶
type Plugin interface { // Get the plugin name, should be consistent with the config file Name() string // Get the plugin version, could be used for simple version control Version() string // Load the plugin with the metadata, e.g., read the config file Load(meta PluginMeta) error // Unload the plugin, e.g., close the file descriptor Unload(meta PluginMeta) error /* Hook processing functions: @param ctx: The context of the plugin. Request and other data could be accessed from the context. The output of the plugin should be stored in the context. See PluginContext for details. */ StartHook(ctx *PluginContext) EndHook(ctx *PluginContext) CreateCgroupHook(ctx *PluginContext) DestroyCgroupHook(ctx *PluginContext) }
A plugin is a shared object that implements the Plugin interface
type PluginContext ¶
type PluginContext struct { GrpcCtx context.Context Type HookType Keys map[string]any // contains filtered or unexported fields }
func NewContext ¶
func NewContext(ctx context.Context, req proto.Message, t HookType, hs *[]PluginHandler) *PluginContext
func (*PluginContext) Abort ¶
func (c *PluginContext) Abort()
Plugin could call this to prevent the following plugins from being called.
func (*PluginContext) Get ¶
func (c *PluginContext) Get(key string) any
func (*PluginContext) Next ¶
func (c *PluginContext) Next()
Plugin could call this to hand over the control to the next plugin. When this returned, the caller may continue.
func (*PluginContext) Request ¶
func (c *PluginContext) Request() proto.Message
func (*PluginContext) Set ¶
func (c *PluginContext) Set(key string, value any)
func (*PluginContext) Start ¶
func (c *PluginContext) Start()
This should only be called by the plugin daemon
type PluginHandler ¶
type PluginHandler func(*PluginContext)
type PluginMeta ¶
Click to show internal directories.
Click to hide internal directories.