blob: 2028a97c412ca70b144f19e4f957b8c9cff31f78 (
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
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include "i_compactable_lid_space.h"
#include <vespa/vespalib/util/isequencedtaskexecutor.h>
#include <memory>
namespace search::common {
/**
* Adapter class for a component that has a lid space that can be
* compacted and shrunk where the write operations are performed by a
* specific thread.
*/
class ThreadedCompactableLidSpace : public ICompactableLidSpace
{
using ISequencedTaskExecutor = vespalib::ISequencedTaskExecutor;
std::shared_ptr<ICompactableLidSpace> _target;
ISequencedTaskExecutor &_executor;
ISequencedTaskExecutor::ExecutorId _executorId;
public:
ThreadedCompactableLidSpace(std::shared_ptr<ICompactableLidSpace> target, ISequencedTaskExecutor &executor,
ISequencedTaskExecutor::ExecutorId executorId);
~ThreadedCompactableLidSpace() override;
void compactLidSpace(uint32_t wantedDocLidLimit) override;
bool canShrinkLidSpace() const override;
size_t getEstimatedShrinkLidSpaceGain() const override;
void shrinkLidSpace() override;
};
}
|