Pair requests with replies using sequence numbers 10/13210/2
authorMilan Lenco <milan.lenco@pantheon.tech>
Mon, 25 Jun 2018 18:31:11 +0000 (20:31 +0200)
committerMilan Lenco <milan.lenco@pantheon.tech>
Tue, 26 Jun 2018 13:07:55 +0000 (15:07 +0200)
commit8adb6cdcb496f05169263d32a857791faf8baee1
tree12bb4fbce0af84326c1a6d80b76a71ad097fdf7d
parente44d8c3905e22f940a100e6331a45412cba9d47e
Pair requests with replies using sequence numbers

Requests are given sequence numbers (cycling over a finite set of 2^16
integers) that are stored into the lower 16bits of the context.
1bit is also allocated for isMultipart boolean flag and the remaining
15bits are used to store the channel ID. The sequence numbers allow
to reliably pair replies with requests, even in scenarious with timeouted
requests or ignored (unread) replies.

Sequencing is not used with asynchronous messaging as it is implemented
by methods of the Channel structure, i.e. above ReqChan and ReplyChan
channels.

Change-Id: I7ca0e8489c7ffcc388c3cfef6d05c02f9500931c
Signed-off-by: Milan Lenco <milan.lenco@pantheon.tech>
adapter/adapter.go
adapter/mock/mock_adapter.go
adapter/vppapiclient/vppapiclient_adapter.go
api/api.go
api/api_test.go
core/core.go
core/core_test.go
core/request_handler.go