the following (pseudo-code, but mostly working)
the problem is that it blocks on the io time consuming code in struct
Cache. that is the scanner "service" is unable to continue finding images
hope this explains the issue, otherwise i will try to make it a working code
package main
import "fmt"
func main() {
cache := services.Cachefunc main() {
scanner := services.Scanner
core := services.Core
go cache.Start()
go scanner.Start()
go core.Start()
}
package services
type Scanner struct {
func (self *Scanner) visit(path string, f os.FileInfo, err error) error {
itemFound <- path}
func (self *Scanner) start() {
// loop over the filesystem, finding imagesfilepath.Walk("/", self.visit)
}
type Core struct {
}
func (self *Core) start() {
for {select {
case msg := <- itemFound
go self.doItemFound(msg)
}
}
}
func (self *Scanner) doItemFound(path string) {
// do some stuffcachePicture <- path
}
type Cache struct {
}func (self *Cache) start() {
for {select {
case msg := <- cachePicture
go self.doCachePicture(msg)
}
}
}
func (self *Cache) doCachePicture(path string) {
// do some time consuming io, copying images from server to local machine}
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.