initial file store
This commit is contained in:
@@ -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")
|
||||
}
|
||||
+1
-3
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user