Documentation ¶
Overview ¶
Package queue manages the queue for a distributed crawler
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrAlreadyReserved = errors.New("host already reserved")
ErrAlreadyReserved indicates another worker reserved the host
View Source
var ErrNotQueued = errors.New("link already queued")
ErrNotQueued indicates a link was not queued
Functions ¶
This section is empty.
Types ¶
type Queuer ¶
type Queuer interface { CountLinks() (int64, error) AddLink(lnk string) error QueueLink(ttl time.Duration) (string, error) ReserveHost(host string, ttl time.Duration) error DelayHost(host string, ttl time.Duration) error }
Queuer is handles links and our crawling queue
type Redis ¶
Redis implements the Queuer interface
func (*Redis) CountLinks ¶
CountLinks counts the number of links in our queue
func (*Redis) DelayHost ¶
DelayHost is like ReserveHost but makes sure the key is already set. If key doesn't exist then something is wrong (eg reservation < crawler's timeout)
Click to show internal directories.
Click to hide internal directories.