• Kirill Smelkov's avatar
    go/neo/neonet: Start (first draft) · 64513925
    Kirill Smelkov authored
    Continue NEO/go with neonet - the layer to exchange messages in between
    NEO nodes.
    
    NEO/go shifts from thinking about NEO protocol logic as RPC to thinking
    of it as more general network protocol and so settles to provide general
    connection-oriented message exchange service. This way neonet provides
    generic connection multiplexing on top of a single TCP node-node link.
    
    Neonet compatibility with NEO/py depends on the following small NEO/py patch:
    
        kirr/neo@dd3bb8b4
    
    which adjusts message ID a bit so it behaves like stream_id in HTTP/2:
    
        - always even for server initiated streams
        - always odd  for client initiated streams
    
    and is incremented by += 2, instead of += 1 to maintain above invariant.
    
    See http://navytux.spb.ru/~kirr/neo.html#development-overview (starting from
    "Then comes the link layer which provides service to exchange messages over
    network...") for the rationale.
    
    Unfortunately current NEO/py maintainer is very much against merging that patch.
    
    This patch brings in the core of neonet. Next patches will add initial
    handshaking, user-level Send/Recv + Ask/Expect and "lightweight mode".
    
    Some neonet core history:
    
    lab.nexedi.com/kirr/neo/commit/6b9ed46d	X neonet: Avoid integer overflow on max packet length check
    lab.nexedi.com/kirr/neo/commit/8eac771c	X neo/connection: Fix race between link.shutdown() and conn.lightClose()
    lab.nexedi.com/kirr/neo/commit/8021a1d5	X rxghandoff
    lab.nexedi.com/kirr/neo/commit/68738036	X ... but negative impact on separate client / server processes, strange ...
    lab.nexedi.com/kirr/neo/commit/b0dda9d2	X serveRecv: help Go scheduler to switch to receiving G sooner
    lab.nexedi.com/kirr/neo/commit/4989918a	X remove defer from rx/tx hot paths
    lab.nexedi.com/kirr/neo/commit/e055406a	X no select for acceptq - similarly for rxq path
    lab.nexedi.com/kirr/neo/commit/c28ad4d0	X Conn.Recv: receive without select
    lab.nexedi.com/kirr/neo/commit/496bd425	X add benchmark RTT over plain net.Conn with serveRecv-style RX handler
    lab.nexedi.com/kirr/neo/commit/9fa79958	X draft how to mark RX down without reallocating .rxdown
    lab.nexedi.com/kirr/neo/commit/4324c812	X restore all Conn functionality
    lab.nexedi.com/kirr/neo/commit/a8e61d2f	X serveSend is not needed
    lab.nexedi.com/kirr/neo/commit/9d047b36	X recvPkt via only 1 syscall
    lab.nexedi.com/kirr/neo/commit/b555a507	X baseline net RTT benchmark
    lab.nexedi.com/kirr/neo/commit/91be5cdd	X everyone is listening from start; CloseAccept to disable listening - works
    lab.nexedi.com/kirr/neo/commit/c2a1b63a	X naming: Packet = raw data; Message = meaningful object
    lab.nexedi.com/kirr/neo/commit/6fd0c9be	X connection: Adding context to errors from NodeLink and Conn operations
    lab.nexedi.com/kirr/neo/commit/65b17bdc	X rework Conn acceptance to be explicit via NodeLink.Accept
    64513925
proto.go 27.7 KB