blob: d00a0714045c71702f7c6a00dcf798d2bd7e0a02 (
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
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include "rawbuf.h"
#include <vespa/vespalib/data/output.h>
namespace search {
class SlimeOutputRawBufAdapter : public vespalib::Output
{
private:
RawBuf &_buf;
public:
SlimeOutputRawBufAdapter(RawBuf &buf) : _buf(buf) {}
vespalib::WritableMemory reserve(size_t reserve) override {
return vespalib::WritableMemory(_buf.GetWritableFillPos(reserve), reserve);
}
Output &commit(size_t commit) override {
_buf.Fill(commit);
return *this;
}
};
} // namespace search
|