Skip to main content

SyncFuture

This is a synchronous future, where the values are available immediately on construction. This is used to maintain a synonymous API with both Async and Sync tasks

Methods​


Ready()​

@classmethod
def Ready() - > bool

Checks if the future's value or error is available. This method always returns true for a SyncFuture as values are available immediately upon construction.

Returns​

TypeDescription
boolTrue, indicating that the future is always ready.

Get()​

@classmethod
def Get(
context: context.Context
) - > (interface{}, error)

Retrieves the value or error stored in the SyncFuture. Callers use this to access the result of the synchronous operation.

Parameters​

NameTypeDescription
contextcontext.ContextThe context for the operation. For SyncFuture, this parameter is not used as the result is immediately available.

Returns​

TypeDescription
(interface{}, error)The actual value or an error, as stored during the SyncFuture's construction.