Releases: Tradias/asio-grpc
v2.8.0
Features
- Add
agrpc::register_callback_rpc_handler
for setting up request handling withagrpc::ServerRPCPtr
, a dynamically allocated ServerRPC which can be used to implement non-coroutine based gRPC servers. - Add experimental support for P2300R7 (
std::execution
) in the form of a new CMake targetasio-grpc::asio-grpc-stdexec
. - Breaking change: Certain completion token like
asio::experimental::use_promise
might now return a different type due to the implementation of Asio's optional requirement on asynchronous operations: The operation's associated I/O executor may be exposed via the Initiation function object's executor_type type alias and get_executor() member function.
Fixes
- Removed all usage of pointer tagging. Although Asio uses it, it is technically undefined behavior.
Performance
- Use Asio's immediate_executor in
ServerRPC::wait_for_done
andWaiter::wait
.
Documentation
- Use Asio's default completion token mechanism in examples.
- Avoid using
asio::detached
in examples since it swallows exceptions. - Document how
register_awaitable_rpc_handler
andregister_yield_rpc_handler
obtain the executor used to spawn the coroutine. - Removed documentation of deprecated CMake options.
Chore
- Remove codeql pipeline
v2.7.0
This release prepares asio-grpc for a large trim down in the next major release by adding an API that follows Asio's I/O object model more closely, avoids the pitfalls of the current API and provides more customization options.
The following headers should be considered deprecated:
bind_allocator.hpp
, cancel_safe.hpp
, default_completion_token.hpp
, get_completion_queue.hpp
, grpc_initiate.hpp
, grpc_stream.hpp
, notify_when_done.hpp
, repeatedly_request_context.hpp
, repeatedly_request.hpp
, rpc.hpp
, use_awaitable.hpp
, wait.hpp
Features
- Add
agrpc::ServerRPC
, new API for asynchronous servers. - Add
agrpc::register_awaitable_rpc_handler
,agrpc::register_yield_rpc_handler
andagrpc::register_sender_rpc_handler
functions for setting up request handling withagrpc::ServerRPC
. - Breaking change in experimental
agrpc::ClientRPC
API:- Rename
agrpc::ClientRPCGenericUnary
toagrpc::GenericUnaryClientRPC
. - Rename
agrpc::ClientRPCGenericStreaming
toagrpc::GenericStreamingClientRPC
.
- Rename
- Make unary ClientRPCs constructible and add
start
,read_initial_metadata
andfinish
member functions.
Fixes
- Avoid UB from casting function pointer to
void*
inClientRPC
,BasicAlarm
andnotify_one_state_change
asynchronous operations. - Consistently take CompletionToken by forwarding-reference.
Performance
- Improve compile times of
ClientRPC
,BasicAlarm
andnotify_one_state_change
asynchronous operations.
Documentation
- Remove documentation of old API.
Chore
- Run sonarscanner on Ubuntu 22.04 with GCC 11 and Java 17.
- Use vcpkg binarycaching with Github Caches.
v2.6.0
Features
- Breaking change in experimental agrpc::RPC API:
- Rename to
agrpc::ClientRPC
andagrpc::ClientRPCType
. - Header name changed to
client_rpc.hpp
. asio::use_awaitable
is no longer the default completion token.- Remove third template parameter.
- For streaming specializations:
- ClientRPC now creates and owns the
grpc::ClientContext
, it can be customized during construction or later access usingcontext()
. - Must now be started by calling
start()
,request()
has been removed. finish()
andwrites_done()
no longer guard against being called multiple times.
- ClientRPC now creates and owns the
- For generic specializations:
- Replace marker values
agrpc::CLIENT_GENERIC_X_RPC
withagrpc::ClientRPCType::GENERIC_X
. - Add type aliases
agrpc::ClientRPCGenericUnary<Executor>
andagrpc::ClientRPCGenericStreaming<Executor>
.
- Replace marker values
- Rename to
- De-experimentalize
agrpc::HealthCheckService
. - Add
cancel()
toagrpc::Alarm
. - Add support for libunifex v0.2.0 to
agrpc::repeatedly_request
.
Fixes
- Typo in
NotfiyWhenDoneFn
Documentation
- Simplify file-transfer example.
Chore
- Update libunifex to v0.2.0. Version 0.3.0 is also supported by held back due to an ICE in clang 10.
v2.5.1
Fixes
- Remove Intellisense workaround from
agrpc::RPC
's RPCType deduction because it causes ICE since Visual Studio 17.5 (C++20 only). See bug report. - Bump asio-grpc version in CMakeLists file.
v2.5.0
Features
- Implement a pool memory resource based on Boost.Container's
unsynchronized_pool_resource
. This makes selecting between<memory_resource>
, Boost.Container andasio::recycling_allocator
obsolete. All related CMake options have been marked deprecated and only affectuses_allocator
specializations now. They will be removed in version 3 which will always usestd::uses_allocator
. - Deprecated: Due to the above, all typedefs in the
agrpc::pmr
namespace are deprecated and will be removed in v3. - Add a new CMake option called
ASIO_GRPC_BUILD_EXAMPLES
which enables compilation of just examples without tests. Also, libunifex is now treated as an optional dependency.
Fixes
agrpc::run*
consumes a high amount of CPU resources when the GrpcContext had already stopped while the second argument (typically an io_context) had work left to do. To resolve that,agrpc::run*
will now end when both contexts are stopped using new functions that were added to the RunTraits.
Documentation
- Create an article on the use of asio::io_context.
Chore
- Treat compiler warnings as error in CI.
v2.4.0
Features
- Add cancellation support to
agrpc::RPC
. - Add a new install option to use asio::recycling_allocator instead of
<memory_resource>
or Boost.Container. This can be handy in combination with libc++ and standalone Asio to avoid taking a dependency on Boost. - Deprecated: Constructor
agrpc::GrpcContext{std::make_unique<grpc::CompletionQueue>()}
, use the new default constructor instead. - Deprecated: Member function
agrpc::CancelSafe::is_running
has been renamed tois_wait_pending()
because it never reported whether the asynchronous operation is still running but instead whether a wait is currently pending.
Fixes
- A failed write with
grpc::WriteOptions::set_last_message
on a high-level client streaming RPC incorrectly completes withtrue
. - The operation state obtained by connecting a receiver to the sender returned by
agprc::notify_when_done
is deallocated during GrpcContext destruction, leading to double free because the lifetime of the operation state is expected to be handled by the connector. - Using
asio::deferred
foragrpc::RPC::finish
andagrpc::RPC::writes_done
does not compile. - The rvalue-overload of
agrpc::Alarm::wait
does not extend the lifetime of the alarm correctly when using completion tokens likeasio::deferred
. - Honor
ASIO_GRPC_USE_BOOST_CONTAINER
CMake variable when using asio-grpc withadd_subdirectory
. - Compatibility of sender/receiver with Asio 1.25/Boost 1.81.
Performance
- Improve performance of high-level client read_initial_metadata, read, write and finish by replacing some if-conditions with compile time dispatch.
- Reduce allocation size of each health check watch request.
- Reduce size of all sender operation states by one pointer and the
notify_when_done
operation state by two pointers.
Documentation
- Correctly state that
agrpc::RPC::read_initial_metadata
may not be called concurrently withwrite
.
Chore
- Adjust .clang-tidy rules.
- Fix CMAKE_UNITY_BUILD and enable it for some CI builds.
- Add test for
add_subdirectory
-consumption of asio-grpc. - Update doxygen and doxygen-awesome.
v2.3.0
Features
- Add agrpc::notify_when_done, a function for grpc::ServerContext::AsyncNotifyWhenDone that does not suffer from memory leaks like a
agrpc::grpc_initiate
version would. - Add agrpc::notify_on_state_change, a function for grpc::ChannelInterface::NotifyOnStateChange.
- Deprecate
agrpc::grpc_initiate
, use the above functions instead. - Add a CompletionQueue-based implementation of grpc::HealthCheckServiceInterface. GRPC's default health check service is implemented with the callback API which significantly reduces the performance of a server that also uses the CompletionQueue API (aka. any functionality of this library).
Chore
- Update libunifex to 2022-10-10 and gRPC to 1.50.1
v2.2.0
Features
- Add
agrpc::RPC<>::service/method_name()
:
package example.v1;
service Example { rpc Unary(Request) returns (Response) {} }
using RPC = agrpc::RPC<&example::v1::Example::Stub::PrepareAsyncUnary>;
static_assert(RPC::service_name() == "example.v1.Example");
static_assert(RPC::method_name() == "Unary");
- Add
agrpc::Alarm
, an I/O object that wrapsgrpc::Alarm
. A safer alternative to theagrpc::wait
free function. Additionally supports ad-hoc waits which automatically extend the lifetime of the underlying gRPC alarm, for example with a callback:
agrpc::Alarm(grpc_context).wait(deadline, [](bool ok, agrpc::Alarm&& alarm) {});
Fixes
- Leak of uncompleted sender operation states and asynchronous operations started by the high-level client API upon destruction of the GrpcContext.
- For each request in the sender overload of
agrpc::repeatedly_request
, make a copy of the request handler to avoid lifetime surprises when the handler returnsunifex::task<>
.
Performance
- Improve compile times by no longer instantiating entire operation states with two different allocators, but instead only their completion function. This affects all free functions, like
agrpc::read
andagrpc::wait
, as well as the high-level client API.
Chore
- Use a more meticulous gRPC shutdown sequence in tests to make them less flaky.
- Update tests and examples to Boost 1.80.
v2.1.0
Features
- Add a high-level client API - a new major feature that makes writing asynchronous gRPC clients easier and safer.
- In
asio_grpc_protobuf_generate
, check the validity ofIMPORT_DIRS
at CMake configure time instead of build time. - The asio-grpc source files can now be consumed without CMake. In that case, the compile definition
AGRPC_USE_BOOST_CONTAINER
can be used to choose between<memory_resource>
and Boost.Container.
Fixes
- Enable cancellation support for standalone Asio 1.19.0 instead of 1.20.0. Note that throwing exceptions from the request handler of
agrpc::repeatedly_request
crashes until 1.19.2. - Correctly handle .proto filenames that include dots in
asio_grpc_protobuf_generate
. - Return correct sender from
asio::execution::schedule(GrpcExecutor)
when compiling in C++17 using MSVC.
Performance
- Turn cancellation check in
agrpc::repeatedly_request
to a no-op when the completion handler does not support cancellation. - Replace most calls to
std::move
andstd::forward
withstatic_cast
and use a simpler version ofstd::tuple
to improve compile times.
Documentation
- State that
read_initial_metadata
will not complete until the server callswrite_initial_metadata
or the client performs a write/finish. - Add generic bidirectional streaming example.
- Add dark mode to documentation website.
Chore
- No longer run CodeQL in Github Actions since it stopped working and never diagnosed anything useful.
v2.0.0
Breaking change: All headers now use snake_case instead of camelCase, e.g. #include <agrpc/asioGrpc.hpp>
becomes #include <agrpc/asio_grpc.hpp>
.
Breaking change: Two overloads for requesting unary RPCs have been removed, example: co_await agrpc::request(&example::v1::Example::Stub::AsyncUnary, stub, client_context, request)
. Please use other means of obtaining a reference to the agrpc::GrpcContext
and then call agrpc::request(&example::v1::Example::Stub::AsyncUnary, stub, client_context, request, grpc_context)
.
Breaking change: Unsafe overloads of agrpc::get_completion_queue
have been removed.
Breaking change: asio-grpcConfig.cmake will now autolink with gRPC::grpc++_unsecure
instead of gRPC::grpc++
. If you are using encrypted gRPC then you need to explicitly link with gRPC::grpc++
in your CMake files.
Breaking change: If the completion handler passed to an asynchronous operation does not have an associated allocator then asio-grpc will no longer attempt to retrieve one from the associated executor through asio::query(executor, asio::execution::allocator)
. This behavior had been deprecated in v1.6.0.
Features
- Add
run_until(deadline)
toagrpc::GrpcContext
. - Add
PrepareAsync
overloads for requesting RPCs in a thread-safe manner. - Deprecate the
Async
overloads for requesting client-side streaming RPCs as they can lead to race-conditions. - Add
agrpc::BasicGrpcStream
overload toagrpc::get_completion_queue
. - Make
agrpc::AllocatorBinder
fully constexpr compatible.
Style
- No longer use
std::aligned_storage
since it is deprecated in C++23. - Continue to implement compile time improvements.
Documentation
- Add examples for multi-threaded clients and servers.
- Make the
ServerShutdown
that is used in examples thread-safe.
Chore
- Asio-grpc is now available on conan-center!
- Use CTest's
--build-and-test
command for the asio-grpc-cmake test. Also use an older version of CMake (3.16) for that test. - Remove GCC 9 and Clang 11 pipelines.
- Update doctest, gRPC, gtest, libunifex and liburing in the pipelines.