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

FIFO

As the name implies, when a stage operates in FIFO mode, it processes payloads sequentially, thereby maintaining their order. By creating a pipeline where all stages use FIFO dispatching, we can enforce synchronous-like semantics for data processing, but still retain the high throughput benefits associated with an asynchronous pipeline.

The fifo type is private within the pipeline package, but it can be instantiated via a call to the FIFO function, which is outlined as follows:

type fifo struct {
    proc Processor
}

// FIFO returns a StageRunner that processes incoming payloads in a 
// first-in first-out fashion. Each input is passed to the specified 
// processor and its output is emitted to the next stage.
func FIFO(proc Processor) ...
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