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

Instantiating and operating master nodes

As you probably guessed, the Master type would encapsulate the implementation details for creating and operating a master node. Let's take a quick look into its constructor:

func NewMaster(cfg MasterConfig) (*Master, error) {
    if err := cfg.Validate(); err != nil {
        return nil, xerrors.Errorf("master config validation failed: %w", err)
    }
    return &Master{
        cfg:        cfg,
        workerPool: newWorkerPool(),
    }, nil
}

The constructor expects a MasterConfig object as an argument that defines the following:

  • It defines the address where the master node will be listening for incoming connections.
  • It defines the job.Runner instance for interfacing with the user-defined graph algorithm.
  • It defines Serializer for marshaling ...
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