Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-5446

Add async protocol read

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • None

    Description

      I propose to add the ability to read async.

      Design:

      • Declare a new (async) trait `TInputStreamProtocol`
      #[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<()>;
          ...
      
      • 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")

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              jorgecarleitao Jorge Leitão
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 2h
                  2h