1- package octopus
1+ package adapters
22
33import (
44 "fmt"
55 "io"
66 "log"
77 "os"
8+
9+ oct "github.com/rapidclock/web-octopus/octopus"
810)
911
1012// OutputAdapter is the interface for the Adapter that is used to handle
@@ -15,14 +17,14 @@ import (
1517// Implementers of the interface should listen on this channel for output from
1618// the crawler.
1719type OutputAdapter interface {
18- Consume (quitCh <- chan bool ) chan <- CrawlOutput
20+ Consume (quitCh <- chan bool ) chan <- oct. CrawlOutput
1921}
2022
2123// StdOpAdapter is an output adapter that just prints the output onto the screen.
2224type StdOpAdapter struct {}
2325
24- func (s * StdOpAdapter ) Consume (quitCh <- chan bool ) chan <- CrawlOutput {
25- listenCh := make (chan CrawlOutput )
26+ func (s * StdOpAdapter ) Consume (quitCh <- chan bool ) chan <- oct. CrawlOutput {
27+ listenCh := make (chan oct. CrawlOutput )
2628 go func () {
2729 for {
2830 select {
@@ -41,13 +43,13 @@ type FileWriterAdapter struct {
4143 FilePath string
4244}
4345
44- func (fw * FileWriterAdapter ) Consume (quitCh <- chan bool ) chan <- CrawlOutput {
45- listenCh := make (chan CrawlOutput )
46+ func (fw * FileWriterAdapter ) Consume (quitCh <- chan bool ) chan <- oct. CrawlOutput {
47+ listenCh := make (chan oct. CrawlOutput )
4648 fw .writeToFile (quitCh , listenCh )
4749 return listenCh
4850}
4951
50- func (fw * FileWriterAdapter ) writeToFile (quitCh <- chan bool , ch <- chan CrawlOutput ) {
52+ func (fw * FileWriterAdapter ) writeToFile (quitCh <- chan bool , ch <- chan oct. CrawlOutput ) {
5153 fp , err := fw .getFilePointer ()
5254 if err != nil {
5355 fp .Close ()
0 commit comments