Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AggregationWithCache ¶
type AggregationWithCache[T comparable] struct { Aggregation []T Cache map[T]bool }
type AggregationWithCacheAndCounter ¶
type AggregationWithCacheAndCounter[T comparable] struct { Aggregation []T Cache map[T]bool Counter int64 }
type AggregationWithCounter ¶
type ComplexNumber ¶
type ComplexNumber interface { constraints.Complex }
type Future ¶
type Future[T any] struct { // contains filtered or unexported fields }
Future is a type that represents a value that will be available in the future. It is heavily inspired by Java's Future interface. It is used to represent the result of an asynchronous operation and a way to early return from a function.
The creation and completion of the future is done internally, so the user is not expected to create it manually. The user is responsible for obtaining the value from the future. There are two ways to do that: 1. By calling Get() method. This method will block until the value is available. It returns either the pointer to the value or an error. In pippin the error means that the pipeline was interrupted before it could complete that's why the value is not available. 2. By calling GetWithTimeout(timeout time.Duration) method. This method will block until the value is available or the timeout is reached.
The recommended way to obtain the value is by calling GetWithTimeout() method, as otherwise the execution might be blocked forever.
It is possible to manually check whether the future is done or not by calling IsDone() method. This method return a boolean value indicating whether the future is done or not. It is not blocking.
Please, note that since it's the async operation, the value might not be available immediately.
func (*Future[T]) Complete ¶
func (f *Future[T]) Complete(value T)
Complete completes the future with the provided value.
func (*Future[T]) Get ¶
Get returns the value from the future. It blocks until the value is available. It returns either the pointer to the value or an error. The error means that the pipeline was interrupted before it could complete that's why the value is not available.
Use it with caution as it might block the execution forever. As an alternative consider using GetWithTimeout() method.
func (*Future[T]) GetWithTimeout ¶
GetWithTimeout returns the value from the future. It blocks until the value is available or the timeout is reached. It returns either the pointer to the value or an error. The error means that the pipeline was interrupted before it could complete that's why the value is not available.
This is the recommended way to obtain the value from the future.
type Number ¶
type Number interface { constraints.Integer | constraints.Float }