flashmob / go-guerrilla

Mini SMTP server written in golang
MIT License
2.79k stars 366 forks source link

More backends refactoring #71

Closed flashmob closed 7 years ago

flashmob commented 7 years ago

Edit: deleted comment as no longer relevant! See new comment

flashmob commented 7 years ago

This is a huge... YYYYYUGE... backend refactor!

The main idea is to break backend processing down to individual, reusable components. In a nutshell, you'll now be able to customize your backend by configuration, like so:

"process_line": "HeadersParser|Debugger|Hasher|Header|Compressor|Redis|MySql"

Tokens are separated by a pipe '|'. Each token is a component called a "Processor". When an email is processed, it goes through each component in a line, starting at the left and ending on the right.

How's this implemented? It's using a decorator pattern found here https://github.com/smaxwellstewart/golang-decorator-pattern The video was mind-blowing https://www.youtube.com/watch?v=xyDkyFjzFVc

Still need to finalize some things, clean up and determine which interfaces / values need to be public.

flashmob commented 7 years ago

Documentation here https://github.com/flashmob/go-guerrilla/wiki/About-Backends:-introduction,-configuring-and-extending

dvcrn commented 7 years ago

This is really cool! How stable would you say it currently is? Can I start using this in my own fork or better to wait until things are more stable?

flashmob commented 7 years ago

Hi! Thanks for checking it out.

Looking forward to making a release soon.

Currently, this branch passes all the tests and is being tested on a live system too. Although lots of things may change, such as names of things - so no guarantee of stability until it's released :-)

Still todo:

Almost there!

flashmob commented 7 years ago

Thanks @jordanschalm for the review - will be going through these today.

flashmob commented 7 years ago

@jordanschalm still going through it (and fixing problems), marking the ones that are fixed. Just want to say thanks again. Your reviews are very thorough with lots of attention to detail! Will have the new README ready for review soon too.

flashmob commented 7 years ago

Worked on adding the pooling of notifyMsg chans. Now working on another optimization: In ValidateRcpt, don't need to place on the channel if we know that there were no validators set in the config.

flashmob commented 7 years ago

@jordanschalm Here is the new README ready for review - https://github.com/flashmob/go-guerrilla/blob/more-backends-refactoring/README.md - things to check: typos, grammar & flow. Also feedback on if it's using the right words to describe things. Thanks!

flashmob commented 7 years ago

@dvcrn @peterkrejci @mrcpvn @eliezedeck Doing some final testing on this PR. If all good - to be merged to master today!

dvcrn commented 7 years ago

@flashmob amazing 😄 fantastic job!