usetech-llc / polkadot_api_cpp

С++ API for Polkadot.
Apache License 2.0
18 stars 21 forks source link

Thread Safe Producer-Consumer #8

Closed usetech-llc closed 5 years ago

usetech-llc commented 5 years ago

Several places in project need to be implemented as a producer-consumer. This issue aims to create a generic purpose concurrent queue, which can be used project-wide. It should be implemented only using STL or Boost and not create additional dependencies. Please do not modify CMakeLists.txt file.

Preliminary interface draft:

template<typename T, typename K>
class ConcurrentMapQueue {
public:
    ConcurrentMapQueue(int max_size);
    void put(K& key, T& value);
    T get(K& key);
    vector<K> getKeys();
    long getKeyAge(K&);
};

Method put should block when the maximum size is reached for the given key. It adds a key-value pair to the corresponding FIFO queue for the given key with a timestamp.

Method get should block when the queue is empty for a particular key. It returns value for the key when it becomes available.

Method getKeys returns all keys in the queue.

Method getKeyAge returns number of seconds passed since the last value for the given key was added (so that garbage collection is possible for key/values that are not demanded).

gitcoinbot commented 5 years ago

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


This issue now has a funding of 150.0 DAI (150.0 USD @ $1.0/DAI) attached to it.

gitcoinbot commented 5 years ago

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


Work has been started.

These users each claimed they can complete the work by 11 months, 1 week from now. Please review their action plans below:

1) chernant has been approved to start work.

Task is clear, I don't have any questions. Ready to start.

Learn more on the Gitcoin Issue Details page.

gitcoinbot commented 5 years ago

@chernant Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

gitcoinbot commented 5 years ago

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


Work for 150.0 DAI (150.0 USD @ $1.0/DAI) has been submitted by:

  1. @chernant

@Web3Foundation please take a look at the submitted work:


Web3Foundation commented 5 years ago

@usetech-llc please let me know after you've checked this work.

gitcoinbot commented 5 years ago

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


The funding of 150.0 DAI (150.0 USD @ $1.0/DAI) attached to this issue has been approved & issued to @chernant.