Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Album ¶
type Album struct { Data struct { Images []Image `json:"images"` } `json:"data"` }
Album - information about images in the album.
type Image ¶
type Image struct { Hash string `json:"hash"` Title string `json:"title"` Width int `json:"width"` Height int `json:"height"` Ext string `json:"ext"` }
Image - information about image.
type ImageWorker ¶
type ImageWorker struct {
// contains filtered or unexported fields
}
ImageWorker - contains information about how to download images and where to store them. Worker receives tasks from "in" channel. when task is done it send signal to "done" channel. Before each task it asks limiter to get permission for execution.
func NewWorker ¶
func NewWorker(host string, in <-chan Image, done chan<- struct{}, path string, grByRes bool, l *rate.Limiter, hc *http.Client) *ImageWorker
NewWorker create new worker instance. If grByRes is true, it will create sub directory WxH.
func (*ImageWorker) Run ¶
func (w *ImageWorker) Run(ctx context.Context)
Run loop which waits tasks in "in" channel until ctx signals done. Before executing tasks it asks limiter for permission.
Click to show internal directories.
Click to hide internal directories.