Documentation
¶
Index ¶
- Constants
- func Backup(maxWorkers int, logfile, src, dst, commit, tag string) (int, error)
- func ViewLogs(logfile, date, reg string) (int, error)
- type App
- func (app *App) AttributeEventHandler(path string)
- func (app *App) CloseQueue()
- func (app *App) CreateBackupFile(path string) error
- func (app *App) CreateEventHandler(path string)
- func (app *App) DeleteEventHandler(path string)
- func (app *App) DeleteRequestHandler(path string)
- func (app *App) IsImmediateDelete(path string) bool
- func (app *App) IsScheduleDelete(path string) (string, string, time.Time, bool)
- func (app *App) ModifyEventHandler(path string)
- func (app *App) ReceiveFolderEventHandler(path string)
- func (app *App) RenameEventHandler(path string)
- func (app *App) SaveAsZipFile(t time.Time) error
- func (app *App) ScheduleDeleteRequests(at time.Time, paths ...string)
- func (app *App) Stop()
- func (app *App) UpdateBackupFileContent(path string) (err error)
- type Monitor
Constants ¶
const SAVE string = "SAVE"
defines ops name for saving backup folder.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type App ¶
type App struct {
// contains filtered or unexported fields
}
App is the structue of an app instance.
func (*App) AttributeEventHandler ¶
AttributeEventHandler just logs folder or file attributes events.
func (*App) CreateBackupFile ¶
CreateBackupFile creates a file into the backup folder with same name as the original file and use `.bat` as extension.
func (*App) CreateEventHandler ¶
CreateEventHandler orchestrates the processing of file creation events.
func (*App) DeleteEventHandler ¶
DeleteEventHandler just logs folder or file delete events.
func (*App) DeleteRequestHandler ¶
DeleteRequestHandler orchestrates the processing of file deletion request.
func (*App) IsImmediateDelete ¶
IsImmediateDelete checks wether the filename matches the required pattern to trigger immediate deletion action of that file.
func (*App) IsScheduleDelete ¶
IsScheduleDelete checks if a filename matches the required pattern to trigger a scheduling deletion action of that file. It matches if the name follow this pattern `delete_ISODATETIME`. The ISODATETIME should matches the RFC3339 ("2006-01-02T15:04:05Z07:00") format. If so, it returns the absolute source & backup filepaths and datetime.
func (*App) ModifyEventHandler ¶
ModifyEventHandler orchestrates the processing of file content modification events.
func (*App) ReceiveFolderEventHandler ¶
ReceiveFolderEventHandler handles folder added into the source folder. It configures the App watcher to immediately monitor all files inside the folder and its sub-folders. All files found are backed up immediately according to events rules.
func (*App) RenameEventHandler ¶
RenameEventHandler just logs folder or file renaming events.
func (*App) SaveAsZipFile ¶
SaveAsZipFile orchestrates the creation of a zip archive of backup folder.
func (*App) ScheduleDeleteRequests ¶
ScheduleDeleteRequests adds each absolute filepath and its deletion datetime to the map store.
func (*App) Stop ¶
func (app *App) Stop()
Stop stops the app instance by closing the stop channel which all goroutines and workers listen on to exit.
func (*App) UpdateBackupFileContent ¶
UpdateBackupFileContent copies the content of a given file path to its the backup file.