mirror of
https://github.com/jhillyerd/inbucket.git
synced 2025-12-23 12:37:07 +00:00
storage: Make type/params configurable for #88
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
||||
"strconv"
|
||||
"sync"
|
||||
|
||||
"github.com/jhillyerd/inbucket/pkg/config"
|
||||
"github.com/jhillyerd/inbucket/pkg/storage"
|
||||
)
|
||||
|
||||
@@ -25,10 +26,10 @@ type mbox struct {
|
||||
var _ storage.Store = &Store{}
|
||||
|
||||
// New returns an emtpy memory store.
|
||||
func New() *Store {
|
||||
func New(cfg config.Storage) (storage.Store, error) {
|
||||
return &Store{
|
||||
boxes: make(map[string]*mbox),
|
||||
}
|
||||
}, nil
|
||||
}
|
||||
|
||||
// AddMessage stores the message, message ID and Size will be ignored.
|
||||
|
||||
@@ -3,6 +3,7 @@ package mem
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/jhillyerd/inbucket/pkg/config"
|
||||
"github.com/jhillyerd/inbucket/pkg/storage"
|
||||
"github.com/jhillyerd/inbucket/pkg/test"
|
||||
)
|
||||
@@ -10,7 +11,7 @@ import (
|
||||
// TestSuite runs storage package test suite on file store.
|
||||
func TestSuite(t *testing.T) {
|
||||
test.StoreSuite(t, func() (storage.Store, func(), error) {
|
||||
s := New()
|
||||
s, _ := New(config.Storage{})
|
||||
destroy := func() {}
|
||||
return s, destroy, nil
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user