about summary refs log tree commit diff stats
path: root/internal/storage/files/reader.go
diff options
context:
space:
mode:
authorAlan Pearce2025-01-29 22:00:45 +0100
committerAlan Pearce2025-01-29 23:27:45 +0100
commit3162ceaa0f7997742f8c2fce1c9660e8e86ad5bb (patch)
tree14c424b8ef8b9238e69393cd7da1d0af6833526e /internal/storage/files/reader.go
parenta93b5ad88ea3cf742cf03fdeeb95f63865f08374 (diff)
downloadwebsite-3162ceaa0f7997742f8c2fce1c9660e8e86ad5bb.tar.lz
website-3162ceaa0f7997742f8c2fce1c9660e8e86ad5bb.tar.zst
website-3162ceaa0f7997742f8c2fce1c9660e8e86ad5bb.zip
use buffers as interface to storage
Diffstat (limited to 'internal/storage/files/reader.go')
-rw-r--r--internal/storage/files/reader.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/internal/storage/files/reader.go b/internal/storage/files/reader.go
index 425436b..fff37da 100644
--- a/internal/storage/files/reader.go
+++ b/internal/storage/files/reader.go
@@ -5,6 +5,7 @@ import (
 	"path/filepath"
 	"strings"
 
+	"go.alanpearce.eu/website/internal/storage"
 	"go.alanpearce.eu/x/log"
 
 	"gitlab.com/tozd/go/errors"
@@ -13,14 +14,14 @@ import (
 type Reader struct {
 	root  string
 	log   *log.Logger
-	files map[string]*File
+	files map[string]*storage.File
 }
 
 func NewReader(path string, log *log.Logger) (*Reader, error) {
 	r := &Reader{
 		root:  path,
 		log:   log,
-		files: make(map[string]*File),
+		files: make(map[string]*storage.File),
 	}
 	if err := r.registerContentFiles(); err != nil {
 		return nil, errors.WithMessagef(err, "registering content files")
@@ -69,8 +70,8 @@ func (r *Reader) registerContentFiles() error {
 	return nil
 }
 
-func (r *Reader) GetFile(urlPath string) *File {
-	return r.files[urlPath]
+func (r *Reader) GetFile(urlPath string) (*storage.File, error) {
+	return r.files[urlPath], nil
 }
 
 func (r *Reader) CanonicalisePath(path string) (cPath string, differs bool) {