Skip to content
Snippets Groups Projects
  • Vladislav Shpilevoy's avatar
    2b1143a7
    session: introduce binary box.session.push · 2b1143a7
    Vladislav Shpilevoy authored
    Box.session.push() allows to send a message to a client with no
    finishing a main request. Tarantool after this patch supports
    pushes over binary protocol.
    
    IProto message is encoded using a new header code - IPROTO_CHUNK.
    Push works as follows: a user calls box.session.push(message).
    The message is encoded into currently active obuf in TX thread,
    and then Kharon notifies IProto thread about new data.
    
    Originally Kharon is the ferryman of Hades who carries souls of
    the newly deceased across the rivers Styx and Acheron that
    divided the world of the living from the world of the dead. In
    Tarantool Kharon is a message and does the similar work. It
    notifies IProto thread about new data in an output buffer
    carrying pushed messages to IProto. Styx here is cpipe, and the
    boat is cbus message.
    
    One connection has single Kharon for all pushes. But Kharon can
    not be in two places at the time. So once he got away from TX to
    IProto, new messages can not send Kharon. They just set a special
    flag. When Kharon is back to TX and sees the flag is set, he
    immediately takes the road back to IProto.
    
    Herewith a user is not blocked to write to obuf when Kharon is
    busy. The user just updates obuf and set the flag if not set.
    There is no waiting for Kharon arrival back.
    
    Closes #2677
    2b1143a7
    History
    session: introduce binary box.session.push
    Vladislav Shpilevoy authored
    Box.session.push() allows to send a message to a client with no
    finishing a main request. Tarantool after this patch supports
    pushes over binary protocol.
    
    IProto message is encoded using a new header code - IPROTO_CHUNK.
    Push works as follows: a user calls box.session.push(message).
    The message is encoded into currently active obuf in TX thread,
    and then Kharon notifies IProto thread about new data.
    
    Originally Kharon is the ferryman of Hades who carries souls of
    the newly deceased across the rivers Styx and Acheron that
    divided the world of the living from the world of the dead. In
    Tarantool Kharon is a message and does the similar work. It
    notifies IProto thread about new data in an output buffer
    carrying pushed messages to IProto. Styx here is cpipe, and the
    boat is cbus message.
    
    One connection has single Kharon for all pushes. But Kharon can
    not be in two places at the time. So once he got away from TX to
    IProto, new messages can not send Kharon. They just set a special
    flag. When Kharon is back to TX and sees the flag is set, he
    immediately takes the road back to IProto.
    
    Herewith a user is not blocked to write to obuf when Kharon is
    busy. The user just updates obuf and set the flag if not set.
    There is no waiting for Kharon arrival back.
    
    Closes #2677