From 8b017e645d80054ade75922e0aec7b7bf1a46d03 Mon Sep 17 00:00:00 2001 From: Jerry Zhao Date: Mon, 12 Oct 2026 08:18:03 +0000 Subject: [PATCH 1/5] Use awaitable TCP stream operations --- bycorf | 2 +- src/replication/replication.cpp | 5 +++-- src/replication/replication_internal.h | 13 +++++++------ 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/bycorf b/bycorf index 7904686b9..cb678aa20 160000 --- a/bycorf +++ b/bycorf @@ -1 +1 @@ -Subproject commit 7904686b97ca107b4adaee1982f13742995a3430 +Subproject commit cb678aa208f4b3e148c927ec9a01966e1ff416ae diff --git a/src/replication/replication.cpp b/src/replication/replication.cpp index 8e57a7601..6d61e8604 100644 --- a/src/replication/replication.cpp +++ b/src/replication/replication.cpp @@ -706,11 +706,12 @@ std::uint32_t DataFrameCrc32c(std::string_view first, return static_cast(crc); } -Task WriteText(TcpStream& stream, const char* text) { +TcpStream::WriteAllAwaitable WriteText(TcpStream& stream, const char* text) { return WriteText(stream, std::string_view(text)); } -Task WriteText(TcpStream& stream, std::string_view text) { +TcpStream::WriteAllAwaitable WriteText(TcpStream& stream, + std::string_view text) { return stream.WriteAll(std::span( reinterpret_cast(text.data()), text.size())); } diff --git a/src/replication/replication_internal.h b/src/replication/replication_internal.h index 60d11a2f4..6db7099db 100644 --- a/src/replication/replication_internal.h +++ b/src/replication/replication_internal.h @@ -373,14 +373,15 @@ std::vector SplitWords(std::string_view line); std::string EncodeRespCommand(std::span args); -Task WriteText(TcpStream& stream, std::string_view text); +TcpStream::WriteAllAwaitable WriteText(TcpStream& stream, + std::string_view text); -Task WriteText(TcpStream& stream, const char* text); +TcpStream::WriteAllAwaitable WriteText(TcpStream& stream, const char* text); -// A Task starts after the call expression has finished. Force temporary -// command/reply buffers into a caller-owned local instead of allowing a -// string_view to outlive them. -Task WriteText(TcpStream&, std::string&&) = delete; +// Writes borrow their payload until completion. Force temporary command/reply +// buffers into a caller-owned local instead of allowing a string_view to +// outlive them. +TcpStream::WriteAllAwaitable WriteText(TcpStream&, std::string&&) = delete; std::uint32_t DataFrameCrc32c(std::string_view first, std::string_view second = {}) noexcept; From d83de06f2243907d7af7ac3573472f653037d6d7 Mon Sep 17 00:00:00 2001 From: Jerry Zhao Date: Mon, 12 Oct 2026 10:06:54 +0000 Subject: [PATCH 2/5] Preserve full-write coroutine APIs and completion scheduling --- bycorf | 2 +- src/replication/replication.cpp | 5 ++--- src/replication/replication_internal.h | 13 ++++++------- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/bycorf b/bycorf index cb678aa20..aedee7a12 160000 --- a/bycorf +++ b/bycorf @@ -1 +1 @@ -Subproject commit cb678aa208f4b3e148c927ec9a01966e1ff416ae +Subproject commit aedee7a1212a6ad908452164f2abe57c51210816 diff --git a/src/replication/replication.cpp b/src/replication/replication.cpp index 6d61e8604..8e57a7601 100644 --- a/src/replication/replication.cpp +++ b/src/replication/replication.cpp @@ -706,12 +706,11 @@ std::uint32_t DataFrameCrc32c(std::string_view first, return static_cast(crc); } -TcpStream::WriteAllAwaitable WriteText(TcpStream& stream, const char* text) { +Task WriteText(TcpStream& stream, const char* text) { return WriteText(stream, std::string_view(text)); } -TcpStream::WriteAllAwaitable WriteText(TcpStream& stream, - std::string_view text) { +Task WriteText(TcpStream& stream, std::string_view text) { return stream.WriteAll(std::span( reinterpret_cast(text.data()), text.size())); } diff --git a/src/replication/replication_internal.h b/src/replication/replication_internal.h index 6db7099db..60d11a2f4 100644 --- a/src/replication/replication_internal.h +++ b/src/replication/replication_internal.h @@ -373,15 +373,14 @@ std::vector SplitWords(std::string_view line); std::string EncodeRespCommand(std::span args); -TcpStream::WriteAllAwaitable WriteText(TcpStream& stream, - std::string_view text); +Task WriteText(TcpStream& stream, std::string_view text); -TcpStream::WriteAllAwaitable WriteText(TcpStream& stream, const char* text); +Task WriteText(TcpStream& stream, const char* text); -// Writes borrow their payload until completion. Force temporary command/reply -// buffers into a caller-owned local instead of allowing a string_view to -// outlive them. -TcpStream::WriteAllAwaitable WriteText(TcpStream&, std::string&&) = delete; +// A Task starts after the call expression has finished. Force temporary +// command/reply buffers into a caller-owned local instead of allowing a +// string_view to outlive them. +Task WriteText(TcpStream&, std::string&&) = delete; std::uint32_t DataFrameCrc32c(std::string_view first, std::string_view second = {}) noexcept; From 8154850475e0a58136fef86cbb8cf67916ef17a9 Mon Sep 17 00:00:00 2001 From: Jerry Zhao Date: Mon, 12 Oct 2026 10:34:56 +0000 Subject: [PATCH 3/5] Adopt TLS read and write awaitables --- bycorf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bycorf b/bycorf index aedee7a12..65a0eb809 160000 --- a/bycorf +++ b/bycorf @@ -1 +1 @@ -Subproject commit aedee7a1212a6ad908452164f2abe57c51210816 +Subproject commit 65a0eb80957309aeaf11b11ada81ff5dc23a7558 From e5cbed3219cb3094b81cc78c9a077abe3f245ce1 Mon Sep 17 00:00:00 2001 From: Jerry Zhao Date: Mon, 12 Oct 2026 11:12:56 +0000 Subject: [PATCH 4/5] Restore original TLS coroutine implementation --- bycorf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bycorf b/bycorf index 65a0eb809..0f0514afc 160000 --- a/bycorf +++ b/bycorf @@ -1 +1 @@ -Subproject commit 65a0eb80957309aeaf11b11ada81ff5dc23a7558 +Subproject commit 0f0514afcdb1da4bfa157125fea3b220e9981a2d From df9a293cfd745f7d5ff38421a07b05cfcca098fe Mon Sep 17 00:00:00 2001 From: Jerry Zhao Date: Mon, 12 Oct 2026 11:42:54 +0000 Subject: [PATCH 5/5] Update Bycorf awaitables branch rebased onto main --- bycorf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bycorf b/bycorf index 0f0514afc..1c9ba9bcc 160000 --- a/bycorf +++ b/bycorf @@ -1 +1 @@ -Subproject commit 0f0514afcdb1da4bfa157125fea3b220e9981a2d +Subproject commit 1c9ba9bcca132397111ae87c72060b342505bada