Browse Source

refactor and merge type declarations to one file, remove unused declarations

flashmob 5 years ago
parent
commit
b84a955f5b
2 changed files with 6 additions and 28 deletions
  1. 6 1
      backends/backend.go
  2. 0 27
      backends/stream_backend.go

+ 6 - 1
backends/backend.go

@@ -16,9 +16,12 @@ import (
 var (
 var (
 	Svc *service
 	Svc *service
 
 
-	// Store the constructor for making an new processor decorator.
+	// processors store the constructors for for composing a new processor using a decorator pattern.
 	processors map[string]ProcessorConstructor
 	processors map[string]ProcessorConstructor
 
 
+	// Streamers store the constructors for composing a new stream-based processor using a decorator pattern.
+	Streamers map[string]StreamProcessorConstructor
+
 	b Backend
 	b Backend
 )
 )
 
 
@@ -30,6 +33,8 @@ func init() {
 
 
 type ProcessorConstructor func() Decorator
 type ProcessorConstructor func() Decorator
 
 
+type StreamProcessorConstructor func() *StreamDecorator
+
 // Backends process received mail. Depending on the implementation, they can store mail in the database,
 // Backends process received mail. Depending on the implementation, they can store mail in the database,
 // write to a file, check for spam, re-transmit to another server, etc.
 // write to a file, check for spam, re-transmit to another server, etc.
 // Must return an SMTP message (i.e. "250 OK") and a boolean indicating
 // Must return an SMTP message (i.e. "250 OK") and a boolean indicating

+ 0 - 27
backends/stream_backend.go

@@ -1,27 +0,0 @@
-package backends
-
-var (
-	Streamers map[string]StreamProcessorConstructor
-)
-
-func init() {
-
-}
-
-type processorCloser interface {
-	Close() error
-}
-
-type CloseWith func() error
-
-// satisfy processorCloser interface
-func (c CloseWith) Close() error {
-	// delegate
-	return c()
-}
-
-type StreamProcessorConstructor func() *StreamDecorator
-
-type streamService struct {
-	service
-}