|
Container System 0.1.0
High-performance C++20 type-safe container framework with SIMD-accelerated serialization
|
Async wrapper for value_container operations. More...
#include <async_container.h>

Public Member Functions | |
| async_container (std::shared_ptr< value_container > container) | |
| Construct async_container with existing container. | |
| async_container () | |
| Construct async_container with new empty container. | |
| async_container (async_container &&other) noexcept=default | |
| Move constructor. | |
| async_container & | operator= (async_container &&other) noexcept=default |
| Move assignment operator. | |
| ~async_container ()=default | |
| Destructor. | |
| async_container (const async_container &)=delete | |
| async_container & | operator= (const async_container &)=delete |
| std::shared_ptr< value_container > | get_container () const noexcept |
| Get the underlying container. | |
| void | set_container (std::shared_ptr< value_container > container) noexcept |
| Set the underlying container. | |
| task< std::vector< uint8_t > > | serialize_async () const |
| Serialize container to byte array asynchronously. | |
| task< std::string > | serialize_string_async () const |
| Serialize container to string asynchronously. | |
| template<typename T > | |
| async_container & | set (std::string_view key, T &&value) |
| Set a value in the container. | |
| template<typename T > | |
| std::optional< T > | get (std::string_view key) const |
| Get a value from the container. | |
| bool | contains (std::string_view key) const noexcept |
| Check if container contains a key. | |
| task< bool > | load_async (std::string_view path, progress_callback callback=nullptr) |
| Load container from file asynchronously. | |
| task< bool > | save_async (std::string_view path, progress_callback callback=nullptr) |
| Save container to file asynchronously. | |
| generator< std::vector< uint8_t > > | serialize_chunked (size_t chunk_size=64 *1024) const |
| Serialize container in chunks using generator. | |
Static Public Member Functions | |
| static task< std::shared_ptr< value_container > > | deserialize_async (std::span< const uint8_t > data) |
| Deserialize from byte array asynchronously. | |
| static task< std::shared_ptr< value_container > > | deserialize_string_async (std::string_view data) |
| Deserialize from string asynchronously. | |
| static task< std::shared_ptr< value_container > > | deserialize_streaming (std::span< const uint8_t > data, bool is_final=true) |
| Deserialize container progressively from chunks. | |
Private Attributes | |
| std::shared_ptr< value_container > | container_ |
Async wrapper for value_container operations.
This class wraps a value_container and provides async versions of serialization and deserialization operations using C++20 coroutines.
The async operations offload CPU-bound work to a separate thread, allowing the calling coroutine to yield and resume when the operation completes.
Properties:
Definition at line 164 of file async_container.h.
|
inlineexplicit |
Construct async_container with existing container.
| container | Shared pointer to value_container |
Definition at line 171 of file async_container.h.
|
inline |
Construct async_container with new empty container.
Definition at line 179 of file async_container.h.
|
defaultnoexcept |
Move constructor.
|
default |
Destructor.
|
delete |
|
inlinenodiscardnoexcept |
Check if container contains a key.
| key | Key name to check |
Definition at line 346 of file async_container.h.
References container_.
|
inlinestaticnodiscard |
Deserialize from byte array asynchronously.
Creates a new container from serialized data.
| data | Span of bytes containing serialized container data |
Definition at line 891 of file async_container.h.
References kcenon::container::async::detail::make_async_awaitable().

|
inlinestaticnodiscard |
Deserialize container progressively from chunks.
Creates a streaming deserializer that can accept data chunks progressively and build the container incrementally.
| data | Span of bytes to deserialize (can be partial) |
| is_final | True if this is the final chunk |
Definition at line 1104 of file async_container.h.
References kcenon::container::async::detail::make_async_awaitable().

|
inlinestaticnodiscard |
Deserialize from string asynchronously.
| data | String containing serialized container data |
Definition at line 903 of file async_container.h.
References kcenon::container::async::detail::make_async_awaitable().

|
inlinenodiscard |
Get a value from the container.
| T | Expected value type |
| key | Key name |
Definition at line 329 of file async_container.h.
References container_.
|
inlinenodiscardnoexcept |
Get the underlying container.
Definition at line 207 of file async_container.h.
References container_.
|
inlinenodiscard |
Load container from file asynchronously.
Reads the file in a worker thread and deserializes the content into the container.
| path | File path to load from |
| callback | Optional progress callback |
Definition at line 915 of file async_container.h.
References container_, and kcenon::container::async::detail::make_async_awaitable().

|
defaultnoexcept |
Move assignment operator.
|
delete |
|
inlinenodiscard |
Save container to file asynchronously.
Serializes the container and writes to file in a worker thread.
| path | File path to save to |
| callback | Optional progress callback |
Definition at line 957 of file async_container.h.
References container_, and kcenon::container::async::detail::make_async_awaitable().

|
inlinenodiscard |
Serialize container to byte array asynchronously.
Offloads serialization to a worker thread and returns a task that completes when serialization is done.
Definition at line 869 of file async_container.h.
References container_, and kcenon::container::async::detail::make_async_awaitable().

|
inlinenodiscard |
Serialize container in chunks using generator.
Returns a generator that yields chunks of serialized data. Useful for streaming large containers without loading everything into memory at once.
| chunk_size | Size of each chunk in bytes (default: 64KB) |
Definition at line 1079 of file async_container.h.
References container_.
|
inlinenodiscard |
Serialize container to string asynchronously.
Definition at line 880 of file async_container.h.
References container_, and kcenon::container::async::detail::make_async_awaitable().

|
inline |
Set a value in the container.
| T | Value type |
| key | Key name |
| value | Value to set |
Definition at line 316 of file async_container.h.
References container_.
|
inlinenoexcept |
Set the underlying container.
| container | New container to wrap |
Definition at line 216 of file async_container.h.
References container_.
|
private |
Definition at line 471 of file async_container.h.
Referenced by contains(), get(), get_container(), load_async(), save_async(), serialize_async(), serialize_chunked(), serialize_string_async(), set(), and set_container().