feat: restart to apply update, privileged helper, rollback
This commit is contained in:
1 parent
70460e4170
commit
54e8fd5fed
63 files changed
+8635
-164
No files matched your search
@@ -0,0 +1,36 @@
|
||||
package update
|
||||
|
||||
import (
|
||||
domain "RenewCMS/internal/domain/update"
|
||||
)
|
||||
|
||||
type FSResultStore struct {
|
||||
files domain.HelperFilesystem
|
||||
path string
|
||||
}
|
||||
|
||||
var _ domain.ResultStore = &FSResultStore{}
|
||||
|
||||
func NewFSResultStore(files domain.HelperFilesystem, path string) *FSResultStore {
|
||||
return &FSResultStore{files: files, path: path}
|
||||
}
|
||||
|
||||
func (s *FSResultStore) Read() (domain.Result, bool) {
|
||||
info, err := s.files.Lstat(s.path)
|
||||
if err != nil || !info.IsRegular {
|
||||
return domain.Result{}, false
|
||||
}
|
||||
content, err := s.files.ReadFile(s.path)
|
||||
if err != nil {
|
||||
return domain.Result{}, false
|
||||
}
|
||||
return decodeResult(content)
|
||||
}
|
||||
|
||||
func (s *FSResultStore) Write(result domain.Result) error {
|
||||
return writeJSONThroughTemporary(s.files, s.path, result, readableFilePermissions)
|
||||
}
|
||||
|
||||
func (s *FSResultStore) Delete() error {
|
||||
return removeThrough(s.files, s.path)
|
||||
}
|
||||
Reference in new issue
Block a user