You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Jorge Leitão (Jira)" <ji...@apache.org> on 2021/08/01 11:19:00 UTC

[jira] [Created] (THRIFT-5446) Add async protocol read

Jorge Leitão created THRIFT-5446:
------------------------------------

             Summary: Add async protocol read
                 Key: THRIFT-5446
                 URL: https://issues.apache.org/jira/browse/THRIFT-5446
             Project: Thrift
          Issue Type: New Feature
          Components: Rust - Compiler, Rust - Library
            Reporter: Jorge Leitão


I propose to add the ability to read async.

Design:
 * Declare a new (async) trait `TInputStreamProtocol`

{code:java}
#[async_trait]
pub trait TInputStreamProtocol {
    /// Read the beginning of a Thrift message.
    async fn read_message_begin(&mut self) -> crate::Result<TMessageIdentifier>;
    /// Read the end of a Thrift message.
    async fn read_message_end(&mut self) -> crate::Result<()>;
    ...
{code}

* generate code to target this trait

This would add two dependencies, futures and async_trait.

We could feature-gate them, but the generation would also require a flag (or a different name, e.g. `rs-async`). Alternatively, just add the two dependencies, which are very small.

Note that rust is effectively collored wrt to async, so the compiler needs both implementations, unfortunately. Fortunately, the differences are small and we can probably abstract everything with "bool is_sync = true")



--
This message was sent by Atlassian Jira
(v8.3.4#803005)