bitshares / bitshares-core

BitShares Blockchain node and command-line wallet
https://bitshares.github.io/
Other
1.17k stars 648 forks source link

Add "set_auto_subscription" API #726

Closed abitmore closed 5 years ago

abitmore commented 6 years ago

Once set_subscribe_callback is called, when calling get_objects and etc, the node will automatically subscribe the queried objects for the client. Sometimes it's not desired. Since it's hard to modify all other API's without breaking things, I think we can add a set_auto_subscription(bool) API, so the clients can control whether to automatically subscribe on follow-up queries.

By the way, I think the subscribing mechanism need an overhaul, see #777.

jmjatlanta commented 6 years ago

One way to tackle this is to replace our bloom filter implementation with a counting bloom filter. An example (MIT licensed) is https://github.com/le1ca/bloomfilter/blob/master/inc/CountingBloomFilter.hpp.

With that in place, we can add a simple API method that calls the filter's delete method.

Note: counting bloom filters open up the possibility of false negatives. Cuckoo filters suffer the same problem. In short, you must have previously inserted an item in the filter in order to delete it without causing false negatives.

Update - another implementation: https://github.com/queertypes/boost-bloom-filters/blob/master/boost/bloom_filter/counting_bloom_filter.hpp

abitmore commented 5 years ago

Related: https://github.com/bitshares/bitshares-ui/issues/2612

abitmore commented 5 years ago

@sschiessl-bcp mentioned in https://github.com/bitshares/bitshares-core/issues/777#issuecomment-481675944:

Possible a set_subscribe_behavior that toggles the default subscription behavior (only subscribe if I add the optional parameter in every call with true)

abitmore commented 5 years ago

See PR #1731. @sschiessl-bcp

oxarbitrage commented 5 years ago

closed by the merge of https://github.com/bitshares/bitshares-core/pull/1731