mirror of
https://github.com/ehang-io/nps.git
synced 2025-09-04 13:36:53 +00:00
pugin init
This commit is contained in:
34
core/struct.go
Normal file
34
core/struct.go
Normal file
@@ -0,0 +1,34 @@
|
||||
package core
|
||||
|
||||
import (
|
||||
"context"
|
||||
)
|
||||
|
||||
// This structure is used to describe the plugin configuration item name and description.
|
||||
type Config struct {
|
||||
ConfigName string
|
||||
Description string
|
||||
}
|
||||
|
||||
type Stage uint8
|
||||
|
||||
// These constants are meant to describe the stage in which the plugin is running.
|
||||
const (
|
||||
STAGE_START_RUN_END Stage = iota
|
||||
STAGE_START_RUN
|
||||
STAGE_START_END
|
||||
STAGE_RUN_END
|
||||
STAGE_START
|
||||
STAGE_END
|
||||
STAGE_RUN
|
||||
)
|
||||
|
||||
// Plugin interface, all plugins must implement those functions.
|
||||
type Plugin interface {
|
||||
GetConfigName() []*Config
|
||||
GetBeforePlugin() Plugin
|
||||
GetStage() Stage
|
||||
Start(ctx context.Context, config map[string]string) error
|
||||
Run(ctx context.Context, config map[string]string) error
|
||||
End(ctx context.Context, config map[string]string) error
|
||||
}
|
Reference in New Issue
Block a user