mirror of
				https://gitee.com/dromara/mayfly-go
				synced 2025-11-04 00:10:25 +08:00 
			
		
		
		
	!96 删除数据库备份和恢复历史
* feat: 删除数据库备份历史 * refactor dbScheduler * feat: 从数据库备份历史中恢复数据库 * feat: 删除数据库恢复历史记录 * refactor dbScheuler
This commit is contained in:
		@@ -26,6 +26,7 @@ var _ DbJob = (*DbBinlog)(nil)
 | 
			
		||||
// DbBinlog 数据库备份任务
 | 
			
		||||
type DbBinlog struct {
 | 
			
		||||
	DbJobBaseImpl
 | 
			
		||||
	DbInstanceId uint64 // 数据库实例ID
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func NewDbBinlog(instanceId uint64) *DbBinlog {
 | 
			
		||||
@@ -35,13 +36,17 @@ func NewDbBinlog(instanceId uint64) *DbBinlog {
 | 
			
		||||
	return job
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (b *DbBinlog) GetInstanceId() uint64 {
 | 
			
		||||
	return b.DbInstanceId
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (b *DbBinlog) GetDbName() string {
 | 
			
		||||
	// binlog 是全库级别的
 | 
			
		||||
	return ""
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (b *DbBinlog) Schedule() (time.Time, error) {
 | 
			
		||||
	switch b.GetJobBase().LastStatus {
 | 
			
		||||
	switch b.LastStatus {
 | 
			
		||||
	case DbJobSuccess:
 | 
			
		||||
		return time.Time{}, runner.ErrJobFinished
 | 
			
		||||
	case DbJobFailed:
 | 
			
		||||
@@ -57,8 +62,28 @@ func (b *DbBinlog) IsEnabled() bool {
 | 
			
		||||
	return true
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (b *DbBinlog) SetEnabled(_ bool) {}
 | 
			
		||||
func (b *DbBinlog) IsExpired() bool {
 | 
			
		||||
	return false
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (b *DbBinlog) SetEnabled(_ bool, _ string) {}
 | 
			
		||||
 | 
			
		||||
func (b *DbBinlog) GetInterval() time.Duration {
 | 
			
		||||
	return 0
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (b *DbBinlog) GetJobType() DbJobType {
 | 
			
		||||
	return DbJobTypeBinlog
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (b *DbBinlog) SetLastStatus(status DbJobStatus, err error) {
 | 
			
		||||
	b.setLastStatus(b.GetJobType(), status, err)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (b *DbBinlog) GetKey() DbJobKey {
 | 
			
		||||
	return b.getKey(b.GetJobType())
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (b *DbBinlog) SetStatus(status DbJobStatus, err error) {
 | 
			
		||||
	b.setLastStatus(b.GetJobType(), status, err)
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user