From d2b2f934a030f0d4a97b25f5788ddd20c8a75eeb Mon Sep 17 00:00:00 2001 From: Natercio Moniz Date: Sun, 12 Jul 2026 07:56:52 +0100 Subject: [PATCH] initial file store --- internal/file_store.go | 29 +++++++++++++++++++++++++++++ internal/report.go | 4 +--- 2 files changed, 30 insertions(+), 3 deletions(-) create mode 100644 internal/file_store.go diff --git a/internal/file_store.go b/internal/file_store.go new file mode 100644 index 0000000..fe46870 --- /dev/null +++ b/internal/file_store.go @@ -0,0 +1,29 @@ +package internal + +import ( + "fmt" + "os" +) + +// FileStore loads and saves the state into a file +type FileStore struct { + file *os.File +} + +func NewFileStore(filename string) (*FileStore, error) { + f, err := os.Open(filename) + if err != nil { + return nil, err + } + return &FileStore{ + file: f, + }, nil +} + +func (fs *FileStore) Load() (map[string]*FillerQueue, error) { + return nil, fmt.Errorf("not implemented") +} + +func (fs *FileStore) Save(map[string]*FillerQueue) error { + return fmt.Errorf("not implemented") +} diff --git a/internal/report.go b/internal/report.go index b043c21..eb0e6b0 100644 --- a/internal/report.go +++ b/internal/report.go @@ -148,8 +148,6 @@ func BuildReport(ctx context.Context, reader RecordReader, writer ReportWriter, } } } - - return nil } // processRecord either adds buys to the queue or consumes buys from the queue when processing a @@ -186,7 +184,7 @@ func processRecord(ctx context.Context, q *FillerQueue, rec Record, sel Selector return ErrInsufficientBoughtVolume } - // Since we don't apply selectors while processing buys we need to apply them here, befre we + // Since we don't apply selectors while processing buys we need to apply them here, before we // actually use them. if !sel(buy) { continue