From 3162ceaa0f7997742f8c2fce1c9660e8e86ad5bb Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 29 Jan 2025 22:00:45 +0100 Subject: use buffers as interface to storage --- internal/storage/files/reader.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'internal/storage/files/reader.go') 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) { -- cgit 1.4.1