batches

package module
v0.0.0-...-973bf30 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 16, 2019 License: MIT Imports: 1 Imported by: 1

README

go-batches

Consolidates items into batches and processes them.

Documentation

Full docs are available on Godoc

Documentation

Overview

Package batches consolidates items into batches and processes them. Usually, the creation of items is considered to be fast compared to the final processing (like for example creating git commits vs. pushing them to a repository.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Combiner

type Combiner struct {
	CombineFunc func(inputs []In) Out
	Input       chan Item
}

Combiner consolidates tasks

func (*Combiner) Announce

func (c *Combiner) Announce() (chan<- In, <-chan Out)

Announce a new Item which will be processed on the next run of the combiner

func (*Combiner) Close

func (c *Combiner) Close()

Close stops processing any new Requests

func (*Combiner) Deliver

func (c *Combiner) Deliver(val In) <-chan Out

Deliver an Item

func (*Combiner) DeliverSync

func (c *Combiner) DeliverSync(val In) Out

DeliverSync delivers an Item and waits until it's been processed

func (*Combiner) Process

func (c *Combiner) Process()

Process must be called once and will start immideatly processing incoming Items using the "CombineFunc".

type In

type In interface{}

In is the Input Type of an Item

type Item

type Item struct {
	In  chan In
	Out chan Out
}

An Item to be processed

type Out

type Out interface{}

Out is the Output Type of the Combine Function

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL