Refactor filesystem to not be dependent on a server struct

This commit is contained in:
Dane Everitt
2020-09-27 12:24:08 -07:00
parent de30e2fcc9
commit 0f7bb1a371
27 changed files with 1203 additions and 1088 deletions

View File

@@ -35,7 +35,7 @@ func (s *Server) notifyPanelOfBackup(uuid string, ad *backup.ArchiveDetails, suc
func (s *Server) getServerwideIgnoredFiles() ([]string, error) {
var ignored []string
f, err := os.Open(path.Join(s.Filesystem.Path(), ".pteroignore"))
f, err := os.Open(path.Join(s.Filesystem().Path(), ".pteroignore"))
if err != nil {
if !os.IsNotExist(err) {
return nil, err
@@ -70,7 +70,7 @@ func (s *Server) GetIncludedBackupFiles(ignored []string) (*backup.IncludedFiles
}
// Get the included files based on the root path and the ignored files provided.
return s.Filesystem.GetIncludedFiles(s.Filesystem.Path(), ignored)
return s.Filesystem().GetIncludedFiles(s.Filesystem().Path(), ignored)
}
// Performs a server backup and then emits the event over the server websocket. We
@@ -83,7 +83,7 @@ func (s *Server) Backup(b backup.BackupInterface) error {
return errors.WithStack(err)
}
ad, err := b.Generate(inc, s.Filesystem.Path())
ad, err := b.Generate(inc, s.Filesystem().Path())
if err != nil {
if notifyError := s.notifyPanelOfBackup(b.Identifier(), &backup.ArchiveDetails{}, false); notifyError != nil {
s.Log().WithFields(log.Fields{