/
print.go
43 lines (35 loc) · 868 Bytes
/
print.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package main
import (
"fmt"
"github.com/sbinet/go-tucs/tucs"
)
type printWorker struct {
tucs.Base
nregions int
}
func PrintWorker(rtype tucs.RegionType) tucs.Worker {
w := &printWorker{
Base: tucs.NewBase(rtype),
nregions: 0,
}
return w
}
func (w *printWorker) ProcessStart() error {
fmt.Printf("::worker-start...\n")
fmt.Printf("::worker-start...[done]\n")
return nil
}
func (w *printWorker) ProcessStop() error {
fmt.Printf("::worker-stop...\n")
fmt.Printf(" processed [%d] region(s) of type [%s]\n",
w.nregions, w.RegionType())
fmt.Printf("::worker-stop... [done]\n")
return nil
}
func (w *printWorker) ProcessRegion(region *tucs.Region) error {
//fmt.Printf("::process-region [%s]...\n", region.Name(0))
w.nregions++
return nil
}
// check printWorker satisfies the tucs.Worker interface
var _ tucs.Worker = (*printWorker)(nil)