RemoteTagCache: use IntrusiveHashSet instead of boost::intrusive::unordered_set
This commit is contained in:
parent
c943e27d51
commit
a43062c575
|
@ -30,8 +30,7 @@ static constexpr Domain remote_tag_cache_domain("remote_tag_cache");
|
|||
RemoteTagCache::RemoteTagCache(EventLoop &event_loop,
|
||||
RemoteTagCacheHandler &_handler) noexcept
|
||||
:handler(_handler),
|
||||
defer_invoke_handler(event_loop, BIND_THIS_METHOD(InvokeHandlers)),
|
||||
map(typename KeyMap::bucket_traits(&buckets.front(), buckets.size()))
|
||||
defer_invoke_handler(event_loop, BIND_THIS_METHOD(InvokeHandlers))
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -45,11 +44,10 @@ RemoteTagCache::Lookup(const std::string &uri) noexcept
|
|||
{
|
||||
std::unique_lock<Mutex> lock(mutex);
|
||||
|
||||
KeyMap::insert_commit_data hint;
|
||||
auto [tag, value] = map.insert_check(uri, Item::Hash(), Item::Equal(), hint);
|
||||
auto [tag, value] = map.insert_check(uri);
|
||||
if (value) {
|
||||
auto item = new Item(*this, uri);
|
||||
map.insert_commit(*item, hint);
|
||||
map.insert(tag, *item);
|
||||
waiting_list.push_back(*item);
|
||||
lock.unlock();
|
||||
|
||||
|
|
|
@ -25,8 +25,7 @@
|
|||
#include "event/InjectEvent.hxx"
|
||||
#include "thread/Mutex.hxx"
|
||||
#include "util/IntrusiveList.hxx"
|
||||
|
||||
#include <boost/intrusive/unordered_set.hpp>
|
||||
#include "util/IntrusiveHashSet.hxx"
|
||||
|
||||
#include <string>
|
||||
|
||||
|
@ -45,7 +44,7 @@ class RemoteTagCache final {
|
|||
Mutex mutex;
|
||||
|
||||
struct Item final
|
||||
: public boost::intrusive::unordered_set_base_hook<boost::intrusive::link_mode<boost::intrusive::normal_link>>,
|
||||
: public IntrusiveHashSetHook<>,
|
||||
public IntrusiveListHook<>,
|
||||
RemoteTagHandler
|
||||
{
|
||||
|
@ -113,12 +112,9 @@ class RemoteTagCache final {
|
|||
*/
|
||||
ItemList invoke_list;
|
||||
|
||||
typedef boost::intrusive::unordered_set<Item,
|
||||
boost::intrusive::hash<Item::Hash>,
|
||||
boost::intrusive::equal<Item::Equal>,
|
||||
boost::intrusive::constant_time_size<true>> KeyMap;
|
||||
|
||||
std::array<typename KeyMap::bucket_type, 127> buckets;
|
||||
using KeyMap = IntrusiveHashSet<Item, 127, Item::Hash, Item::Equal,
|
||||
IntrusiveHashSetBaseHookTraits<Item>,
|
||||
true>;
|
||||
|
||||
KeyMap map;
|
||||
|
||||
|
|
Loading…
Reference in New Issue