blob: fc43402d68efb28b74cbed0af571a76450ed03da (
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
37
38
|
// Copyright Verizon Media. 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 feedbm {
BucketInfoQueue::BucketInfoQueue(storage::spi::PersistenceProvider& provider, std::atomic<uint32_t>& errors)
: _mutex(),
_buckets(),
_provider(provider),
_errors(errors)
{
}
BucketInfoQueue::~BucketInfoQueue()
{
get_bucket_info_loop();
}
void
BucketInfoQueue::get_bucket_info_loop()
{
std::unique_lock guard(_mutex);
while (!_buckets.empty()) {
auto bucket = _buckets.front();
_buckets.pop_front();
guard.unlock();
auto bucket_info = _provider.getBucketInfo(bucket);
if (bucket_info.hasError()) {
++_errors;
}
guard.lock();
}
}
}
|