blob: c731e40d28657187e6b44a8ef25f64c9f756e05c (
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
39
40
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "attributesaver.h"
#include "iattributesavetarget.h"
using vespalib::GenerationHandler;
namespace search {
AttributeSaver::AttributeSaver(GenerationHandler::Guard &&guard,
const attribute::AttributeHeader &header)
: _guard(std::move(guard)),
_header(header)
{
}
AttributeSaver::~AttributeSaver() = default;
bool
AttributeSaver::save(IAttributeSaveTarget &saveTarget)
{
saveTarget.setHeader(_header);
if (!saveTarget.setup()) {
return false;
}
if (!onSave(saveTarget)) {
return false;
}
saveTarget.close();
return true;
}
bool
AttributeSaver::hasGenerationGuard() const
{
return _guard.valid();
}
} // namespace search
|