Skip to content

Commit 34afa26

Browse files
committed
moved interface outputadapter to octopus package
1 parent d8af331 commit 34afa26

File tree

2 files changed

+12
-14
lines changed

2 files changed

+12
-14
lines changed
Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,6 @@ import (
99
oct "github.com/rapidclock/web-octopus/octopus"
1010
)
1111

12-
// OutputAdapter is the interface for the Adapter that is used to handle
13-
// output from the Octopus Crawler.
14-
// The contract stipulates that the crawler provides the channel
15-
// to listen for a quit command.
16-
// The crawler pumps its output onto the returned channel of the Consume method.
17-
// Implementers of the interface should listen on this channel for output from
18-
// the crawler.
19-
type OutputAdapter interface {
20-
Consume(quitCh <-chan bool) chan<- oct.CrawlOutput
21-
}
22-
2312
// StdOpAdapter is an output adapter that just prints the output onto the screen.
2413
type StdOpAdapter struct{}
2514

octopus/models.go

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ package octopus
33
import (
44
"io"
55
"time"
6-
7-
"github.com/rapidclock/web-octopus/adapter"
86
)
97

108
// Node is used to represent each crawled link and its associated depth of crawl.
@@ -41,10 +39,21 @@ type CrawlOptions struct {
4139
CrawlRate time.Duration
4240
RespectRobots bool
4341
IncludeBody bool
44-
OpAdapter adapter.OutputAdapter
42+
OpAdapter OutputAdapter
4543
}
4644

4745
type CrawlOutput struct {
4846
Node
4947
Body io.ReadCloser
5048
}
49+
50+
// OutputAdapter is the interface for the Adapter that is used to handle
51+
// output from the Octopus Crawler.
52+
// The contract stipulates that the crawler provides the channel
53+
// to listen for a quit command.
54+
// The crawler pumps its output onto the returned channel of the Consume method.
55+
// Implementers of the interface should listen on this channel for output from
56+
// the crawler.
57+
type OutputAdapter interface {
58+
Consume(quitCh <-chan bool) chan<- CrawlOutput
59+
}

0 commit comments

Comments
 (0)