utils

package
v1.0.12 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckAndCleanBackups added in v1.0.5

func CheckAndCleanBackups(
	backupPrefix, backupDir string,
	retentionTime, backupCycleTime int,
	now time.Time,
) (bool, error)

CheckAndCleanBackups 检查归档目录下归档文件是否需要清理及是否可以进行归档操作的函数

参数:

backupPrefix: 归档文件前缀名
backupDir: 归档文件目录路径
retentionTime: 归档文件保存时间,单位天
backupCycleTime: 归档操作周期,单位天
now: 当前检查时间

返回值:

true: 需要归档操作; false: 不需要归档
错误

func GetBackupFileName added in v1.0.5

func GetBackupFileName(backupPrefix string, now time.Time) string

func GetPid

func GetPid(path string) (int, error)

GetPid, 查询pid文件并返回pid 返回值:

pid
错误

func ReadFile

func ReadFile(path string) ([]byte, error)

ReadFile, 读取文件函数 参数:

path: 文件路径字符串

返回值:

文件数据
错误

func RemoveFiles

func RemoveFiles(files []string) error

func SortInsertInt

func SortInsertInt(slice []int, ints ...int) []int

func SortInsertUniqInt

func SortInsertUniqInt(slice []int, ints ...int) []int

func TarGZ

func TarGZ(dest string, filenames []string) (err error)

TarGZ, 归档操作函数

参数:

dest: 归档文件路径
filenames: 配置文件路径切片

返回值:

错误

Types

type ConfigFingerprinter

type ConfigFingerprinter interface {
	Diff(fingerprinter ConfigFingerprinter) bool
	Renew(fingerprinter ConfigFingerprinter)
}

func NewConfigFingerprinter

func NewConfigFingerprinter(dataMap map[string][]byte) ConfigFingerprinter

Jump to

Keyboard shortcuts

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