func (fs Fs) Writer(f kit.File, create bool) (string, io.WriteCloser, apperror.Error) { id := f.GetBackendId() if create { id = f.GetFullName() } return fs.WriterById(f.GetBucket(), id, create) }
func (h *FileService) Delete(f kit.File, u kit.User) apperror.Error { // Delete file from backend. if f.GetBackendName() != "" && f.GetBackendId() != "" { backend := h.Backend(f.GetBackendName()) if backend == nil { h.Registry().Logger().Errorf("Deleting file %v in backend %v, which is unconfigured", f.GetId(), f.GetBackendName()) } else { if err := backend.DeleteFile(f); err != nil { return err } } } return h.resource.Delete(f, u) }
func (fs Fs) Reader(f kit.File) (kit.ReadSeekerCloser, apperror.Error) { return fs.ReaderById(f.GetBucket(), f.GetBackendId()) }
func (fs Fs) DeleteFile(f kit.File) apperror.Error { return fs.DeleteFileById(f.GetBucket(), f.GetBackendId()) }
func (fs Fs) FileSize(file kit.File) (int64, apperror.Error) { return fs.FileSizeById(file.GetBucket(), file.GetBackendId()) }
func (fs Fs) HasFile(f kit.File) (bool, apperror.Error) { return fs.HasFileById(f.GetBucket(), f.GetBackendId()) }