Skip to content

Commit

Permalink
Move interface to a separate file
Browse files Browse the repository at this point in the history
Signed-off-by: Elis Lulja <[email protected]>
  • Loading branch information
asimpleidea committed Jan 4, 2021
1 parent 6ee1110 commit 9a81113
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 15 deletions.
18 changes: 18 additions & 0 deletions interface.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package websitepoller

import "context"

// Poller is in charge of polling a website and providing results to a
// function that will handle the result
type Poller interface {
// Start polling
Start(ctx context.Context, now bool)
// SetHandlerFunc sets the function that will be called when a poll has
// finished
SetHandlerFunc(HandlerFunc)
// GetID returns the ID of this poller. If the `Page` struct provided
// to `New` contained a non-empty `ID`, then this returns the same ID as
// the one contained in there, otherwise it returns a randomly generated
// one.
GetID() string
}
15 changes: 0 additions & 15 deletions poller.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,6 @@ func init() {
zerolog.SetGlobalLevel(zerolog.InfoLevel)
}

// Poller is in charge of polling a website and providing results to a
// function that will handle the result
type Poller interface {
// Start polling
Start(ctx context.Context, now bool)
// SetHandlerFunc sets the function that will be called when a poll has
// finished
SetHandlerFunc(HandlerFunc)
// GetID returns the ID of this poller. If the `Page` struct provided
// to `New` contained a non-empty `ID`, then this returns the same ID as
// the one contained in there, otherwise it returns a randomly generated
// one.
GetID() string
}

type pagePoller struct {
id string
httpClient *http.Client
Expand Down

0 comments on commit 9a81113

Please sign in to comment.