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

Go: Link between THeader and context object

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 0.14.0
    • Go - Library
    • None

    Description

      We have "raw" THeader support for Go inĀ THRIFT-4612 now, the next step would be to make them more easily accessible.

      The are 2 directions, 4 parts of this ticket:

      • client -> server (requests)
        • Read headers on server
        • Write headers on client
      • server -> client (responses)
        • Write headers on server
        • Read headers on client

      Take the reading on server as an example. Currently we can read the headers from either the transport or the protocol, but neither the transport nor the protocol objects are "easily accessible" when you are writing the business logic code (writing the request handler in the server code). It would be much better if we inject the headers into the context object passed into the request handlers.

      We already have code injecting the headers to the context object that lives outside of the thrift library working. I'll send out a PR in the coming days to add that to the thrift library, so the performance would be better (we no longer need to do the extra injecting work), and it would be a lot easier to use.

      We'll think about how to best do the client writing part (probably auto read the headers from the context object that passed into the client request code, and write to THeaderProtocol automatically), and send out a PR soon-ish.

      The other direction, server -> client, is used much less often with headers, so we'll probably punt on it for now, and come back revisit them in the future.

      Attachments

        Activity

          People

            Unassigned Unassigned
            fishywang Yuxuan Wang
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

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