libp2p/utils/future

Search:
Group by:
Source   Edit  

Types

AllFuturesFailedError = object of CatchableError
Source   Edit  

Procs

proc allFuturesWaitOrTimeout[Fut](futs: seq[Fut]; timeout: Duration): InternalRaisesFuture[
    void, (CancelledError,)] {....stackTrace: false, raises: [], gcsafe, raises: [].}
Source   Edit  
proc anyCompleted[T](futs: seq[T]): InternalRaisesFuture[T,
    (AllFuturesFailedError, CancelledError)] {....stackTrace: false, raises: [],
    gcsafe, raises: [].}
Returns a future that will complete with the first future that completes. If all futures fail or futs is empty, the returned future will fail with AllFuturesFailedError. Source   Edit  
proc collectCompleted[T, E](futs: seq[InternalRaisesFuture[T, E]];
                            timeout: chronos.Duration): InternalRaisesFuture[
    seq[T], (CancelledError,)] {....stackTrace: false, raises: [], gcsafe,
                                 raises: [].}
Wait up to timeout; collect only successfully completed futures. Ignore results from futures throwing errors Source   Edit  
proc trackFut[T](futs: var seq[T]; fut: T) {....raises: [].}
Prune finished futures, then take ownership of fut for later teardown. Source   Edit  
proc waitForTCPServer(taddr: TransportAddress; retries: int = 20;
                      delay: chronos.Duration = 500.milliseconds): Future[bool] {.
    ...stackTrace: false, raises: [], gcsafe, raises: [], tags: [RootEffect],
    forbids: [].}
Source   Edit  

Templates

template cancelAndWait[T](futs: seq[T]): auto {..}
Source   Edit  
template cancelSoon[T](futs: seq[T]) {..}
Source   Edit  
template completeOnce(fut: auto) {..}
Complete a future only if it is not already finished. Source   Edit  
template completeOnce(fut: auto; val: auto) {..}
Complete a future only if it is not already finished. Source   Edit  
template newFutureCompleted[T](): auto {..}
Source   Edit