Documentation
¶
Index ¶
- type BaseJob
- type BasePluggable
- func (b *BasePluggable) Description() (string, error)
- func (b *BasePluggable) Developer() (string, error)
- func (b *BasePluggable) PeerPluginJobConf() *config.JSON
- func (b *BasePluggable) PeerPluginName() string
- func (b *BasePluggable) PluginConf() *config.JSON
- func (b *BasePluggable) PluginJobConf() *config.JSON
- func (b *BasePluggable) PluginName() (string, error)
- func (b *BasePluggable) SetPeerPluginJobConf(conf *config.JSON)
- func (b *BasePluggable) SetPeerPluginName(name string)
- func (b *BasePluggable) SetPluginConf(conf *config.JSON)
- func (b *BasePluggable) SetPluginJobConf(conf *config.JSON)
- type BasePlugin
- func (b *BasePlugin) Post(ctx context.Context) error
- func (b *BasePlugin) PostHandler(ctx context.Context, conf *config.JSON) error
- func (b *BasePlugin) PreCheck(ctx context.Context) error
- func (b *BasePlugin) PreHandler(ctx context.Context, conf *config.JSON) error
- func (b *BasePlugin) Prepare(ctx context.Context) error
- type BaseTask
- func (b *BaseTask) Format(format string) string
- func (b *BaseTask) JobID() int64
- func (b *BaseTask) SetJobID(jobID int64)
- func (b *BaseTask) SetTaskCollector(collector TaskCollector)
- func (b *BaseTask) SetTaskGroupID(taskGroupID int64)
- func (b *BaseTask) SetTaskID(taskID int64)
- func (b *BaseTask) TaskCollector() TaskCollector
- func (b *BaseTask) TaskGroupID() int64
- func (b *BaseTask) TaskID() int64
- func (b *BaseTask) Wrapf(err error, format string, args ...any) error
- type Job
- type JobCollector
- type Pluggable
- type Plugin
- type RecordReceiver
- type RecordSender
- type Task
- type TaskCollector
- type Type
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseJob ¶
type BaseJob struct {
*BasePlugin
// contains filtered or unexported fields
}
BaseJob - a fundamental job class that assists and simplifies the implementation of job interfaces
func NewBaseJob ¶
func NewBaseJob() *BaseJob
NewBaseJob - a function or method to acquire a new instance of BaseJob
func (*BaseJob) Collector ¶
func (b *BaseJob) Collector() JobCollector
Collector - a component or system that collects data or information
func (*BaseJob) SetCollector ¶
func (b *BaseJob) SetCollector(collector JobCollector)
SetCollector - a function or method to set or configure a collector
type BasePluggable ¶
type BasePluggable struct {
// contains filtered or unexported fields
}
BasePluggable - A basic pluggable interface Used to assist in the implementation of various pluggable interfaces, simplifying their implementation
func NewBasePluggable ¶
func NewBasePluggable() *BasePluggable
NewBasePluggable - Creates a pluggable plugin
func (*BasePluggable) Description ¶
func (b *BasePluggable) Description() (string, error)
Description - Plugin Description, will return an error if description is not present or not a string
func (*BasePluggable) Developer ¶
func (b *BasePluggable) Developer() (string, error)
Developer - Plugin Developer, will return an error if developer is not present or not a string
func (*BasePluggable) PeerPluginJobConf ¶
func (b *BasePluggable) PeerPluginJobConf() *config.JSON
PeerPluginJobConf - Set personalized configuration
func (*BasePluggable) PeerPluginName ¶
func (b *BasePluggable) PeerPluginName() string
PeerPluginName - Corresponding Plugin Name
func (*BasePluggable) PluginConf ¶
func (b *BasePluggable) PluginConf() *config.JSON
PluginConf - Plugin Configuration
func (*BasePluggable) PluginJobConf ¶
func (b *BasePluggable) PluginJobConf() *config.JSON
PluginJobConf - Working Configuration
func (*BasePluggable) PluginName ¶
func (b *BasePluggable) PluginName() (string, error)
PluginName - Plugin Name, will return an error if name is not present or not a string
func (*BasePluggable) SetPeerPluginJobConf ¶
func (b *BasePluggable) SetPeerPluginJobConf(conf *config.JSON)
SetPeerPluginJobConf - Sets the corresponding peer plugin's working configuration
func (*BasePluggable) SetPeerPluginName ¶
func (b *BasePluggable) SetPeerPluginName(name string)
SetPeerPluginName - Sets the corresponding peer plugin name
func (*BasePluggable) SetPluginConf ¶
func (b *BasePluggable) SetPluginConf(conf *config.JSON)
SetPluginConf - Sets the plugin configuration
func (*BasePluggable) SetPluginJobConf ¶
func (b *BasePluggable) SetPluginJobConf(conf *config.JSON)
SetPluginJobConf - Sets the plugin's working configuration
type BasePlugin ¶
type BasePlugin struct {
*BasePluggable
}
BasePlugin - a fundamental plugin class that assists and simplifies the implementation of plugins
func NewBasePlugin ¶
func NewBasePlugin() *BasePlugin
NewBasePlugin - a function or method to create a new instance of BasePlugin
func (*BasePlugin) Post ¶
func (b *BasePlugin) Post(ctx context.Context) error
Post - an empty method for post-notification
func (*BasePlugin) PostHandler ¶
PostHandler - an empty method for post-notification processing
func (*BasePlugin) PreCheck ¶
func (b *BasePlugin) PreCheck(ctx context.Context) error
PreCheck - an empty method for pre-checking
func (*BasePlugin) PreHandler ¶
PreHandler - an empty method for preprocessing
type BaseTask ¶
type BaseTask struct {
*BasePlugin
// contains filtered or unexported fields
}
BaseTask - A basic task that assists and simplifies the implementation of task interfaces
func (*BaseTask) SetTaskCollector ¶
func (b *BaseTask) SetTaskCollector(collector TaskCollector)
SetTaskCollector - Sets the task information collector
func (*BaseTask) SetTaskGroupID ¶
SetTaskGroupID - Sets the unique identifier for a group of tasks
func (*BaseTask) TaskCollector ¶
func (b *BaseTask) TaskCollector() TaskCollector
TaskCollector - Collects information related to tasks
func (*BaseTask) TaskGroupID ¶
TaskGroupID - The unique identifier for a group of tasks
type Job ¶
type Job interface {
Plugin
// Job ID - a unique identifier for a job
JobID() int64
// Set Job ID - a function or method to set the ID of a job
SetJobID(jobID int64)
Collector() JobCollector // todo - The job collector is currently not in use
SetCollector(JobCollector) // todo - The function or method to set the job collector is currently not in use
}
Job - a unit of work
type JobCollector ¶
JobCollector - a work information collector used to collect the progress, error messages, and other information of the entire job. todo: The monitoring module is currently not implemented, so the structure of this interface needs to be implemented later.
type Pluggable ¶
type Pluggable interface {
// Plugin Developer, generally written in the plugin configuration
Developer() (string, error)
// Plugin Description, generally written in the plugin configuration
Description() (string, error)
// Plugin Name, generally written in the plugin configuration
PluginName() (string, error)
/* Plugin Configuration, basic configuration is as follows, the rest can be customized according to individual needs
{
"name" : "mysqlreader",
"developer":"Breeze0806",
"description":"use github.com/go-sql-driver/mysql. database/sql DB execute select sql, retrieve data from the ResultSet. warn: The more you know about the database, the less problems you encounter."
}
*/
PluginConf() *config.JSON
// Plugin Working Configuration
PluginJobConf() *config.JSON
// Corresponding Plugin Name (for Writer, it's Reader; for Reader, it's Writer)
PeerPluginName() string
// Corresponding Plugin Configuration (for Writer, it's Reader; for Reader, it's Writer)
PeerPluginJobConf() *config.JSON
// Set Working Plugin
SetPluginJobConf(conf *config.JSON)
// Set Corresponding Plugin Configuration (for Writer, it's Reader; for Reader, it's Writer)
SetPeerPluginJobConf(conf *config.JSON)
// Set Corresponding Plugin Name (for Writer, it's Reader; for Reader, it's Writer)
SetPeerPluginName(name string)
// Set Plugin Configuration
SetPluginConf(conf *config.JSON)
// Initialize Plugin, needs to be implemented by the implementer according to their needs
Init(ctx context.Context) error
// Destroy Plugin, needs to be implemented by the implementer according to their needs
Destroy(ctx context.Context) error
}
Pluggable - A pluggable interface
type Plugin ¶
type Plugin interface {
Pluggable
// PreCheck - a pre-processing check or verification step
PreCheck(ctx context.Context) error
// Prepare - a preparation step before the main operation
Prepare(ctx context.Context) error
// PostNotification - a notification step after the main operation
Post(ctx context.Context) error
// PreHandler - preprocessing, todo - currently not in use
PreHandler(ctx context.Context, conf *config.JSON) error
// PostHandler - post-notification processing, todo - currently not in use
PostHandler(ctx context.Context, conf *config.JSON) error
}
Plugin - an extension or add-on component
type RecordReceiver ¶
type RecordReceiver interface {
GetFromReader() (element.Record, error) // Reads records from the reader
Shutdown() error // Closes the receiver
}
RecordReceiver - A component that receives records
type RecordSender ¶
type RecordSender interface {
CreateRecord() (element.Record, error) // Create Record
SendWriter(record element.Record) error // Send Record to Writer
Flush() error // Refresh Record to Record Sender
Terminate() error // Terminate Transmission Signal
Shutdown() error // Close
}
RecordSender - Record Sender
type Task ¶
type Task interface {
Plugin
// Task Information Collector, todo - not currently used
TaskCollector() TaskCollector
// Set Task Information Collector, todo - not currently used
SetTaskCollector(collector TaskCollector)
// Job ID
JobID() int64
// Set Job ID
SetJobID(jobID int64)
// Task Group ID
TaskGroupID() int64
// Set Task Group ID
SetTaskGroupID(taskGroupID int64)
// Task ID
TaskID() int64
// Set Task ID
SetTaskID(taskID int64)
// Wrap Error
Wrapf(err error, format string, args ...any) error
// Format - Log format
Format(format string) string
}
Task - An interface for representing tasks
type TaskCollector ¶
type TaskCollector interface {
CollectDirtyRecordWithError(record element.Record, err error)
CollectDirtyRecordWithMsg(record element.Record, msgErr string)
CollectDirtyRecord(record element.Record, err error, msgErr string)
CollectMessage(key string, value string)
}
TaskCollector - a component or system that collects task information todo - currently not in use