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
| Type | Description |
|---|---|
bool | True, 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
| Name | Type | Description |
|---|---|---|
| context | context.Context | The context for the operation. For SyncFuture, this parameter is not used as the result is immediately available. |
Returns
| Type | Description |
|---|---|
(interface{}, error) | The actual value or an error, as stored during the SyncFuture's construction. |