|
A11 (C++ runtime)
Native C++ implementation of the A11 action and streaming runtime
|
Namespaces | |
| namespace | actions |
| namespace | data |
| namespace | internal |
| namespace | net |
| namespace | nodes |
| namespace | obs |
| namespace | service |
| namespace | stores |
Classes | |
| class | Future |
| Shared handle to one asynchronous result. More... | |
| class | Promise |
| Move-only producer for a Future result. More... | |
| struct | Unit |
| Empty success value used by Future<Unit> operations that return no data. More... | |
Typedefs | |
| using | Task = Future< Unit > |
| Asynchronous operation whose only successful result is completion itself. | |
| using | Duration = absl::Duration |
A11 duration; an alias of absl::Duration (nanosecond-aware). | |
| using | Time = absl::Time |
A11 instant; an alias of absl::Time (nanosecond-aware). | |
Functions | |
| void | Schedule (absl::AnyInvocable< void() && > work, thread::TreeOptions tree_options={}) |
| Schedule work on A11's fiber pool without returning a completion handle. | |
| std::function< void()> | ScheduleCancelable (absl::AnyInvocable< void() && > work, thread::TreeOptions tree_options={}) |
| Schedule work and return an idempotent cooperative-cancellation function. | |
| template<typename T > | |
| Future< T > | SubmitWithCancellationHook (absl::AnyInvocable< absl::StatusOr< T >() && > work, std::function< void()> cancellation_hook, thread::TreeOptions tree_options={}) |
| Run work on A11's fiber pool with application-specific cancellation. | |
| template<typename T > | |
| Future< T > | Submit (absl::AnyInvocable< absl::StatusOr< T >() && > work, thread::TreeOptions tree_options) |
| Run status-returning work on the fiber pool and expose its Future. | |
| Task | SubmitTask (absl::AnyInvocable< absl::Status() && > work, thread::TreeOptions tree_options={}) |
| Run an operation that returns only a completion status. | |
| template<typename T > | |
| Future< T > | ReadyFuture (T value) |
Return an already-successful future containing value. | |
| template<typename T > | |
| Future< T > | CompletedFuture (absl::StatusOr< T > result) |
Return an already-completed future containing result. | |
| template<typename T > | |
| Future< T > | FailedFuture (absl::Status status) |
Return an already-failed future containing status. | |
| Task | ReadyTask () |
| Return an already-successful Task. | |
| Task | FailedTask (absl::Status status) |
| Return an already-failed Task. | |
| absl::StatusCode | StatusCodeFromHttp (int http_code) |
| Maps an HTTP status code to a canonical status code. | |
| int | StatusCodeToHttp (absl::StatusCode code) |
| Maps a canonical status code to its HTTP status code. | |
| absl::StatusCode | StatusCodeFromWebSocket (std::uint16_t close_code) |
| Maps a WebSocket close code to a canonical status code. | |
| std::uint16_t | StatusCodeToWebSocket (absl::StatusCode code) |
| Maps a canonical status code to its WebSocket close code. | |
| absl::Status | MakeStatus (absl::StatusCode code, std::string message, nlohmann::json details) |
| Builds a status carrying an A11 structured-details payload. | |
| nlohmann::json | StatusDetails (const absl::Status &status) |
| Extracts the structured-details payload from a status. | |
| absl::StatusOr< nlohmann::json > | StatusToJson (const absl::Status &status) |
| Serializes a status (code, message, details) to JSON. | |
| absl::StatusOr< absl::Status > | StatusFromJson (const nlohmann::json &value) |
| Reconstructs a status from its JSON representation. | |
| Duration | ZeroDuration () |
| Returns the zero duration. | |
| Duration | InfiniteDuration () |
| Returns the duration greater than every finite duration. | |
| Time | Now () |
| Returns the current wall-clock time from Abseil's clock. | |
| Time | InfiniteFuture () |
| Returns the instant later than every finite time. | |
| Time | InfinitePast () |
| Returns the instant earlier than every finite time. | |
| absl::StatusOr< std::int64_t > | DurationNanoseconds (Duration duration) |
| Converts a duration to whole nanoseconds. | |
| absl::StatusOr< std::int64_t > | TimeNanosecondsSinceEpoch (Time time) |
| Converts an instant to nanoseconds since the Unix epoch. | |
Variables | |
| constexpr std::string_view | kStatusDetailsPayloadUrl |
| Type URL identifying A11's status-details payload. | |
| using a11::Duration = typedef absl::Duration |
A11 duration; an alias of absl::Duration (nanosecond-aware).
Asynchronous operation whose only successful result is completion itself.
Return an already-completed future containing result.
| absl::StatusOr< std::int64_t > a11::DurationNanoseconds | ( | Duration | duration | ) |
Converts a duration to whole nanoseconds.
| duration | Duration to convert. |
duration is infinite and therefore not representable. Return an already-failed future containing status.
|
inline |
Return an already-failed Task.
| Duration a11::InfiniteDuration | ( | ) |
Returns the duration greater than every finite duration.
| Time a11::InfiniteFuture | ( | ) |
Returns the instant later than every finite time.
| Time a11::InfinitePast | ( | ) |
Returns the instant earlier than every finite time.
| absl::Status a11::MakeStatus | ( | absl::StatusCode | code, |
| std::string | message, | ||
| nlohmann::json | details | ||
| ) |
Builds a status carrying an A11 structured-details payload.
The details JSON is attached to the returned absl::Status so it survives the JSON and MessagePack bridges used across the wire.
| code | Canonical status code (use kOk for success). |
| message | Human-readable message. |
| details | Arbitrary structured detail payload. |
code, message and details. | Time a11::Now | ( | ) |
Returns the current wall-clock time from Abseil's clock.
Return an already-successful future containing value.
|
inline |
Return an already-successful Task.
Schedule work on A11's fiber pool without returning a completion handle.
Work may await another A11 Future without consuming an OS worker thread.
| std::function< void()> a11::ScheduleCancelable | ( | absl::AnyInvocable< void() && > | work, |
| thread::TreeOptions | tree_options = {} |
||
| ) |
Schedule work and return an idempotent cooperative-cancellation function.
The scheduler retains the root fiber until it has been joined.
| absl::StatusCode a11::StatusCodeFromHttp | ( | int | http_code | ) |
Maps an HTTP status code to a canonical status code.
| http_code | HTTP status code. |
absl::StatusCode; unknown codes map to kUnknown rather than an invented status. | absl::StatusCode a11::StatusCodeFromWebSocket | ( | std::uint16_t | close_code | ) |
Maps a WebSocket close code to a canonical status code.
| close_code | WebSocket close code. |
absl::StatusCode; unknown codes map to kUnknown. | int a11::StatusCodeToHttp | ( | absl::StatusCode | code | ) |
Maps a canonical status code to its HTTP status code.
| code | Canonical status code. |
| std::uint16_t a11::StatusCodeToWebSocket | ( | absl::StatusCode | code | ) |
Maps a canonical status code to its WebSocket close code.
| code | Canonical status code. |
| nlohmann::json a11::StatusDetails | ( | const absl::Status & | status | ) |
Extracts the structured-details payload from a status.
| status | Status to inspect. |
| absl::StatusOr< absl::Status > a11::StatusFromJson | ( | const nlohmann::json & | value | ) |
Reconstructs a status from its JSON representation.
| value | JSON produced by StatusToJson. |
value is not a valid Status document. | absl::StatusOr< nlohmann::json > a11::StatusToJson | ( | const absl::Status & | status | ) |
Serializes a status (code, message, details) to JSON.
| status | Status to serialize. |
| Future< T > a11::Submit | ( | absl::AnyInvocable< absl::StatusOr< T >() && > | work, |
| thread::TreeOptions | tree_options | ||
| ) |
Run status-returning work on the fiber pool and expose its Future.
|
inline |
Run an operation that returns only a completion status.
| Future< T > a11::SubmitWithCancellationHook | ( | absl::AnyInvocable< absl::StatusOr< T >() && > | work, |
| std::function< void()> | cancellation_hook, | ||
| thread::TreeOptions | tree_options = {} |
||
| ) |
Run work on A11's fiber pool with application-specific cancellation.
The returned Future requests both cancellation_hook and cancellation of the scheduled fiber when Future::Cancel() is called. Use this for operations that must also interrupt an external SDK or transport; ordinary cooperative A11 work can use Submit(). Cancellation remains a request, so consumers must still observe the Future's eventual result.
| absl::StatusOr< std::int64_t > a11::TimeNanosecondsSinceEpoch | ( | Time | time | ) |
Converts an instant to nanoseconds since the Unix epoch.
| time | Instant to convert. |
time is infinite and therefore not representable. | Duration a11::ZeroDuration | ( | ) |
Returns the zero duration.
|
constexpr |
Type URL identifying A11's status-details payload.