summaryrefslogtreecommitdiff
path: root/stasherpresent.slide
diff options
context:
space:
mode:
Diffstat (limited to 'stasherpresent.slide')
-rw-r--r--stasherpresent.slide120
1 files changed, 50 insertions, 70 deletions
diff --git a/stasherpresent.slide b/stasherpresent.slide
index f9e7aba..1d99181 100644
--- a/stasherpresent.slide
+++ b/stasherpresent.slide
@@ -96,9 +96,11 @@ Code available at
* Implementation
-1. Interfaces
-2. Manager
-3. Especially unfinished stuff: error handling, config parser and the Registry
+- Interfaces
+- Manager
+- Error handling
+- Config parser
+- Registry
* Interfaces
@@ -134,64 +136,60 @@ manager/manager.go
* Manager
func (m *Manager) Run() {
- var wg sync.WaitGroup
- ic := m.Input.Start()
- for w := range ic {
- if w.Error() != nil {
- fmt.Printf("Got an error when getting Work input: %q\n", w.Error())
- continue
- }
- wg.Add(1)
- go func(w *work.Work) {
- nw := m.Filter.Filter(w)
- err := nw.Error()
- if err != nil {
- fmt.Printf("Got an error when filtering Work: %q\n", err)
- }
- err = m.Output.Output(nw)
- if err != nil {
- fmt.Printf("Got an error when outputting Work: %q\n", err)
- }
- wg.Done()
- }(w)
- }
- wg.Wait()
+ var wg sync.WaitGroup
+ ic := m.Input.Start()
+ for w := range ic {
+ if w.Error() != nil {
+ fmt.Printf("Got an error when getting Work input: %q\n", w.Error())
+ continue
+ }
+ wg.Add(1)
+ go func(w *work.Work) {
+ defer wg.Done()
+ nw := m.Filter.Filter(w)
+ err := nw.Error()
+ if err != nil {
+ fmt.Printf("Got an error when filtering Work: %q\n", err)
+ return
+ }
+ err = m.Output.Output(nw)
+ if err != nil {
+ fmt.Printf("Got an error when outputting Work: %q\n", err)
+ }
+ }(w)
+ }
+ wg.Wait()
}
-* Main advantages over shell script
-
-- Error handling
-- Declarative config
-
-
* Error handling
- for w := range ic {
- if w.Error() != nil {
- fmt.Printf("Got an error when getting Work input: %q\n", w.Error())
- continue
- }
- wg.Add(1)
- go func(w *work.Work) {
- nw := m.Filter.Filter(w)
- err := nw.Error()
- if err != nil {
- fmt.Printf("Got an error when filtering Work: %q\n", err)
- }
- err = m.Output.Output(nw)
- if err != nil {
- fmt.Printf("Got an error when outputting Work: %q\n", err)
- }
- wg.Done()
- }(w)
- }
+ for w := range ic {
+ if w.Error() != nil {
+ fmt.Printf("Got an error when getting Work input: %q\n", w.Error())
+ continue
+ }
+ wg.Add(1)
+ go func(w *work.Work) {
+ defer wg.Done()
+ nw := m.Filter.Filter(w)
+ err := nw.Error()
+ if err != nil {
+ fmt.Printf("Got an error when filtering Work: %q\n", err)
+ return
+ }
+ err = m.Output.Output(nw)
+ if err != nil {
+ fmt.Printf("Got an error when outputting Work: %q\n", err)
+ }
+ }(w)
+ }
* Config parser
-- Currently only supports string literals (no arrays)
- Hand-written parser
+- Currently only supports string literals (no arrays)
- Uses the Registry to get the modules
@@ -215,24 +213,6 @@ input/http/http.go
}
-* Registry
-
-conf/init.go
-
- import (
- // Initialize the different modules. By importing them in this
- // way, their constructors are registered in the registry.
- _ "github.com/Shugyousha/stasher/input/http"
- _ "github.com/Shugyousha/stasher/input/stdin"
-
- _ "github.com/Shugyousha/stasher/filter/http"
- _ "github.com/Shugyousha/stasher/filter/str"
-
- _ "github.com/Shugyousha/stasher/output/http"
- _ "github.com/Shugyousha/stasher/output/stdout"
- )
-
-
* Implemented modules
- input: stdin, http
@@ -255,5 +235,5 @@ conf/init.go
- Generality and error handling
- Use HTTP for everything?
- Level of "declarativeness" in the configuration
-- Still better off with shell scripts?
+- Still better off with shell scripts and pipes?