Documentation
¶
Overview ¶
A simple implementation of futures in go
A simple implementation of futures in go ¶
A simple implementation of futures in go ¶
A simple implementation of futures in go ¶
A simple implementation of futures in go ¶
A simple implementation of futures in go ¶
A simple implementation of futures in go ¶
A simple implementation of futures in go
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ErrorReducer ¶
type ErrorReducer interface {
// Adds an error to the ErrorReducer
AddError(error)
// Retrieves the combined error
Errors() error
}
An ErrorReducer is a interface for combining errors from multiple Futures
func NewConcatenateErrorReducer ¶
func NewConcatenateErrorReducer(sep string) ErrorReducer
An ErrorReducer that concatenates all error messages into a single error
type Future ¶
type Future interface {
/*
* Starts the calculation.
* Subsequent calls return an error.
*/
Start() error
/*
* The calculated result.
* Subsequent calls return an error.
*/
Results() (interface{}, error)
}
func NewFuncFuture ¶
Creates a new future from a function
type FutureGroup ¶
type FutureGroup interface {
AddFutures(...Future) FutureGroup
Finalize() Future
}
A FutureGroup is a collection of futures that can be processed together
func ParallelFutureGroup ¶
func ParallelFutureGroup(valueReducer ValueReducer, errorReducer ErrorReducer) FutureGroup
* Creates a FutureGroup that will executing the group of futures in parallel. * Results and errors are combined using the ValueReducer and ErrorReducer * respectively.
func SerializeFutureGroup ¶
func SerializeFutureGroup(valueReducer ValueReducer, errorReducer ErrorReducer) FutureGroup
* Creates a FutureGroup that will executing the group of futures serially. * Results and errors are combined using the ValueReducer and ErrorReducer * respectively.
type ValueReducer ¶
type ValueReducer interface {
// Adds a value to the ValueReducer
AddValue(interface{})
// Retrieves the combined values
Values() interface{}
}
A ValueReducer is a interface for combining values from multiple futures
func NewAppendValueReducer ¶
func NewAppendValueReducer(capacity int) ValueReducer
Creates a ValueReducer that appends all values in a slice
func NewConcatenateStringValueReducer ¶
func NewConcatenateStringValueReducer(sep string) ValueReducer
Creates a ValueReducer that converts values to strings and concatenates them.