1
0
mirror of https://github.com/jhillyerd/inbucket.git synced 2025-12-17 17:47:03 +00:00

storage: finish renaming storage packages for #79 #69

- storage: rename DataStore to Store
- file: rename types to appease linter
This commit is contained in:
James Hillyerd
2018-03-10 13:34:35 -08:00
parent 98d8288244
commit a58dfc5e4f
21 changed files with 135 additions and 135 deletions

View File

@@ -73,7 +73,7 @@ var commands = map[string]bool{
// recipientDetails for message delivery
type recipientDetails struct {
address, localPart, domainPart string
mailbox datastore.Mailbox
mailbox storage.Mailbox
}
// Session holds the state of an SMTP session

View File

@@ -26,7 +26,7 @@ type scriptStep struct {
// Test commands in GREET state
func TestGreetState(t *testing.T) {
// Setup mock objects
mds := &datastore.MockDataStore{}
mds := &storage.MockDataStore{}
server, logbuf, teardown := setupSMTPServer(mds)
defer teardown()
@@ -83,7 +83,7 @@ func TestGreetState(t *testing.T) {
// Test commands in READY state
func TestReadyState(t *testing.T) {
// Setup mock objects
mds := &datastore.MockDataStore{}
mds := &storage.MockDataStore{}
server, logbuf, teardown := setupSMTPServer(mds)
defer teardown()
@@ -144,9 +144,9 @@ func TestReadyState(t *testing.T) {
// Test commands in MAIL state
func TestMailState(t *testing.T) {
// Setup mock objects
mds := &datastore.MockDataStore{}
mb1 := &datastore.MockMailbox{}
msg1 := &datastore.MockMessage{}
mds := &storage.MockDataStore{}
mb1 := &storage.MockMailbox{}
msg1 := &storage.MockMessage{}
mds.On("MailboxFor", "u1").Return(mb1, nil)
mb1.On("NewMessage").Return(msg1, nil)
mb1.On("Name").Return("u1")
@@ -259,9 +259,9 @@ func TestMailState(t *testing.T) {
// Test commands in DATA state
func TestDataState(t *testing.T) {
// Setup mock objects
mds := &datastore.MockDataStore{}
mb1 := &datastore.MockMailbox{}
msg1 := &datastore.MockMessage{}
mds := &storage.MockDataStore{}
mb1 := &storage.MockMailbox{}
msg1 := &storage.MockMessage{}
mds.On("MailboxFor", "u1").Return(mb1, nil)
mb1.On("NewMessage").Return(msg1, nil)
mb1.On("Name").Return("u1")
@@ -367,7 +367,7 @@ func (m *mockConn) SetDeadline(t time.Time) error { return nil }
func (m *mockConn) SetReadDeadline(t time.Time) error { return nil }
func (m *mockConn) SetWriteDeadline(t time.Time) error { return nil }
func setupSMTPServer(ds datastore.DataStore) (s *Server, buf *bytes.Buffer, teardown func()) {
func setupSMTPServer(ds storage.Store) (s *Server, buf *bytes.Buffer, teardown func()) {
// Test Server Config
cfg := config.SMTPConfig{
IP4address: net.IPv4(127, 0, 0, 1),

View File

@@ -48,10 +48,10 @@ type Server struct {
storeMessages bool
// Dependencies
dataStore datastore.DataStore // Mailbox/message store
globalShutdown chan bool // Shuts down Inbucket
msgHub *msghub.Hub // Pub/sub for message info
retentionScanner *datastore.RetentionScanner // Deletes expired messages
dataStore storage.Store // Mailbox/message store
globalShutdown chan bool // Shuts down Inbucket
msgHub *msghub.Hub // Pub/sub for message info
retentionScanner *storage.RetentionScanner // Deletes expired messages
// State
listener net.Listener // Incoming network connections
@@ -83,7 +83,7 @@ var (
func NewServer(
cfg config.SMTPConfig,
globalShutdown chan bool,
ds datastore.DataStore,
ds storage.Store,
msgHub *msghub.Hub) *Server {
return &Server{
host: fmt.Sprintf("%v:%v", cfg.IP4address, cfg.IP4port),
@@ -96,7 +96,7 @@ func NewServer(
globalShutdown: globalShutdown,
dataStore: ds,
msgHub: msgHub,
retentionScanner: datastore.NewRetentionScanner(ds, globalShutdown),
retentionScanner: storage.NewRetentionScanner(ds, globalShutdown),
waitgroup: new(sync.WaitGroup),
}
}