server

package
v1.2210.0 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2022 License: MPL-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ActionTypeAudit = iota + 1
	ActionTypeExecute
	ActionTypeRollback
)
View Source
const AuditSchema = "AuditSchema"
View Source
const (
	SqlAuditTaskExpiredTime = 3 * 24 // 3 days
)

Variables

View Source
var (
	ErrActionExecuteOnExecutedTask       = _errors.New("task has been executed, can not do execute on it")
	ErrActionExecuteOnNonAuditedTask     = _errors.New("task has not been audited, can not do execute on it")
	ErrActionRollbackOnRollbackedTask    = _errors.New("task has been rollbacked, can not do rollback on it")
	ErrActionRollbackOnExecuteFailedTask = _errors.New("task has been executed failed, can not do rollback on it")
	ErrActionRollbackOnNonExecutedTask   = _errors.New("task has not been executed, can not do rollback on it")
)

Functions

func Audit added in v1.2202.0

func Audit(l *logrus.Entry, task *model.Task, ruleTemplateName string) (err error)

func AuditSQLByDBType added in v1.2207.0

func AuditSQLByDBType(l *logrus.Entry, sql string, dbType string, ruleTemplateName string) (*model.Task, error)

func AuditSQLByDriver added in v1.2207.0

func AuditSQLByDriver(l *logrus.Entry, sql string, d driver.Driver) (*model.Task, error)

func ExecuteWorkflow added in v1.2112.0

func ExecuteWorkflow(workflow *model.Workflow, needExecTaskIdToUserId map[uint]uint) error

func HookAudit added in v1.2207.0

func HookAudit(l *logrus.Entry, task *model.Task, hook AuditHook, ruleTemplateName string) (err error)

func InitSqled

func InitSqled(exit chan struct{})

Types

type AuditHook added in v1.2207.0

type AuditHook interface {
	BeforeAudit(sql *model.ExecuteSQL)
	AfterAudit(sql *model.ExecuteSQL)
}

type EmptyAuditHook added in v1.2207.0

type EmptyAuditHook struct{}

func (*EmptyAuditHook) AfterAudit added in v1.2207.0

func (e *EmptyAuditHook) AfterAudit(sql *model.ExecuteSQL)

func (*EmptyAuditHook) BeforeAudit added in v1.2207.0

func (e *EmptyAuditHook) BeforeAudit(sql *model.ExecuteSQL)

type Sqled

type Sqled struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Sqled is an async task scheduling service. receive tasks from queue, the tasks include inspect, execute, rollback; and the task will only be executed once.

func GetSqled

func GetSqled() *Sqled

func (*Sqled) AddTask

func (s *Sqled) AddTask(taskId string, typ int) error

func (*Sqled) AddTaskWaitResult

func (s *Sqled) AddTaskWaitResult(taskId string, typ int) (*model.Task, error)

func (*Sqled) CleanExpiredTasks

func (s *Sqled) CleanExpiredTasks(entry *logrus.Entry)

func (*Sqled) CleanExpiredWorkflows

func (s *Sqled) CleanExpiredWorkflows(entry *logrus.Entry)

func (*Sqled) HasTask

func (s *Sqled) HasTask(taskId string) bool

func (*Sqled) Start

func (s *Sqled) Start()

func (*Sqled) WorkflowSchedule added in v1.2112.0

func (s *Sqled) WorkflowSchedule(entry *logrus.Entry)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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