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

Inserting discovered outgoing links to the graph

The next crawler pipeline stage that we will be examining is the graph updater. Its main purpose is to insert newly discovered links into the link graph and create edges connecting them to the web page they were retrieved from. Let's take a look at the definition of the graphUpdater type and its constructor:

type graphUpdater struct {
    updater Graph
}
func newGraphUpdater(updater Graph) *graphUpdater {
    return &graphUpdater{
        updater: updater,
    }
}

The constructor expects an argument of the Graph type, which is nothing more than an interface describing the methods needed for the graph updater to communicate with a link graph component:

type Graph interface {
    UpsertLink(link *graph.Link) error ...
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