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) }