Skip to Content
Hands-On Software Engineering with Golang
book

Hands-On Software Engineering with Golang

by Achilleas Anagnostopoulos
January 2020
Intermediate to advanced
640 pages
16h 56m
English
Packt Publishing
Content preview from Hands-On Software Engineering with Golang

Defining the payload for the crawler

First things first, we need to define the payload that will be shared between the processors for each stage of the pipeline:

type crawlerPayload struct {
    LinkID      uuid.UUID
    URL         string
    RetrievedAt time.Time

    RawContent bytes.Buffer

    // NoFollowLinks are still added to the graph but no outgoing edges
    // will be created from this link to them.
    NoFollowLinks []string

    Links       []string
    Title       string
    TextContent string
}

The first three fields, LinkID, URL, and RetrievedAt, will be populated by the input source. The remaining fields will be populated by the various crawler stages:

  • RawContent is populated by the link fetcher
  • NoFollowLinks and Links are populated by the link extractor
  • Title and TextContent are populated ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Hands-On Software Architecture with Golang

Hands-On Software Architecture with Golang

Jyotiswarup Raiturkar

Publisher Resources

ISBN: 9781838554491Supplemental Content