blob: 15a1c03a5adda2a547063689f63e7ffd19d0a542 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "bucket_info_queue.h"
#include <vespa/persistence/spi/persistenceprovider.h>
namespace search::bmcluster {
BucketInfoQueue::BucketInfoQueue(std::atomic<uint32_t>& errors)
: _mutex(),
_pending_get_bucket_infos(),
_errors(errors)
{
}
BucketInfoQueue::~BucketInfoQueue()
{
get_bucket_info_loop();
}
void
BucketInfoQueue::get_bucket_info_loop()
{
std::unique_lock guard(_mutex);
while (!_pending_get_bucket_infos.empty()) {
auto pending_get_bucket_info = _pending_get_bucket_infos.front();
_pending_get_bucket_infos.pop_front();
guard.unlock();
auto bucket_info = pending_get_bucket_info.second->getBucketInfo(pending_get_bucket_info.first);
if (bucket_info.hasError()) {
++_errors;
}
guard.lock();
}
}
}
|