[services] Tunnelbroker - Fix delivering messages one by one and remove mutex.
Summary:
Using messageID to remove a certain message from the delivery queue, instead of using a receiver deviceID to remove all messages for the device.
1. Message structure changed
To achieve this the DeliveryBroker internal message structure needs to be changed from the current:
map[reciever deviceID] → vector<Message information>
to:
map[receiver deviceID] → Queue → Message information.
2. Conditional variables+mutexes became folly:: UnboundedQueue.
Conditional variables and mutex were removed in favor of folly:: UnboundedQueue
3. Remove is became pop as we are using a queue instead of a map.
The remove function changed to pop to remove the first message from the queue.
4. Function names usage refactoring due to the above changes.
Usage of the functions is also refactored in AMQP and gRPC handlers.
Review notes:
These diffs changes are closely interconnected with each other and it's effective for review to use one diff instead of splitting it. This is a smaller chunk of changes that can be buildable. Removing mutexes is closely interconnected with the structural changes that's why it is related to two tasks simultaneously.
Related linear tasks:
Test Plan:
Run yarn run-tunnelbroker-service and successfully built the service.
Messages are delivered one by one and removed from the queue.
Passed unit tests on D3645.
Reviewers: palys-swm, karol-bisztyga
Reviewed By: palys-swm, karol-bisztyga
Subscribers: benschac, ashoat, palys-swm, Adrian, atul, karol-bisztyga
Differential Revision: https://phabricator.ashoat.com/D3279