Documentation ¶
Overview ¶
Dummy package
Index ¶
- func BackupFile(source string) (string, error)
- func BackupFileToDir(sourcePath, dstDir string) (string, error)
- func BackupFileToDirWithSuffix(sourcePath, dstDir, suffix string) (string, error)
- func GenRandNumber(boundary int64) (int64, error)
- func GenerateTempFile(buf []byte, prefix string) (string, error)
- func GenerateTempFileFullOptions(buf []byte, prefix, dirPath string, perm fs.FileMode) (string, error)
- func GenerateTempFileWithDir(buf []byte, prefix, dirPath string) (string, error)
- func GenerateTempFileWithPerm(buf []byte, prefix string, perm fs.FileMode) (string, error)
- func GenerateYAMLTempFile(obj interface{}, prefix string) (string, error)
- func GenerateYAMLTempFileFullOptions(obj interface{}, prefix, dirPath string, perm fs.FileMode) (string, error)
- func GenerateYAMLTempFileWithDir(obj interface{}, prefix, dirPath string) (string, error)
- func GenerateYAMLTempFileWithPerm(obj interface{}, prefix string, perm fs.FileMode) (string, error)
- func GetFileName(path string) string
- func RemoveFiles(path ...string) error
- func RestartService(unit string) error
- func SliceContentCmp[T comparable](x, y []T) bool
- func SliceDedupe[T comparable](x []T) []T
- func WatchDBusSignal(ctx context.Context, iface, objPath string, handlerFunc func(s *dbus.Signal))
- func WatchFileChange(ctx context.Context, handler FSNotifyHandler, monitorTargets []string)
- type FSNotifyHandler
- type FSNotifyHandlerFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BackupFile ¶
func BackupFileToDir ¶
func GenRandNumber ¶
GenRandNumber generates a random positive number less than the boundary value. The return value should be [0, boundary) and error is nil when success. If the error is not nil, the return value is 0.
func GenerateTempFile ¶
Generate Temp file with buffer, return the file name
func GenerateTempFileFullOptions ¶
func GenerateTempFileFullOptions(buf []byte, prefix, dirPath string, perm fs.FileMode) (string, error)
Generate Temp file with buffer, directory and permission, return the file name
func GenerateTempFileWithDir ¶
Generate Temp file with buffer and directory, return the fullpath
func GenerateTempFileWithPerm ¶
Generate Temp file with buffer and permission, return the file name
func GenerateYAMLTempFile ¶
Generate Temp file with YAML content, return the file name
func GenerateYAMLTempFileFullOptions ¶
func GenerateYAMLTempFileFullOptions(obj interface{}, prefix, dirPath string, perm fs.FileMode) (string, error)
Generate Temp file with YAML content and permission, return the file name
func GetFileName ¶
func RemoveFiles ¶
func RestartService ¶
func SliceContentCmp ¶
func SliceContentCmp[T comparable](x, y []T) bool
SliceContentCmp compares two slices and returns true if they have the same content with any order.
func SliceDedupe ¶
func SliceDedupe[T comparable](x []T) []T
SliceDedupe removes duplicated items and return a non-deplucated items slice.
func WatchDBusSignal ¶
func WatchFileChange ¶
func WatchFileChange(ctx context.Context, handler FSNotifyHandler, monitorTargets []string)
Types ¶
type FSNotifyHandler ¶
func AnyOf ¶
func AnyOf(nextHandler FSNotifyHandler, op fsnotify.Op, ops ...fsnotify.Op) FSNotifyHandler
AnyOf propagates the fsnotify Event to the next FSNotifyHandler only if the event type is one of the specified fsnotify Ops.
type FSNotifyHandlerFunc ¶
FSNotifyHandlerFunc is a callback for fsnotify Events.
func (FSNotifyHandlerFunc) Notify ¶
func (f FSNotifyHandlerFunc) Notify(event fsnotify.Event)