blob: 50a9aab07e3e85585ebacc673e3b889b5dec1d95 (
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 Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include "memory.h"
namespace vespalib {
/**
* Interface used to abstract a source of input data. Note that the
* input data itself is owned by the object implementing this
* interface.
**/
struct Input
{
/**
* Obtain more input data. An empty Memory should be returned if
* and only if all input data has been exhausted.
*
* @return the obtained input data
**/
virtual Memory obtain() = 0;
/**
* Evict processed input data. Never evict more data than you have
* obtained.
*
* @return this object, for chaining
* @param bytes the number of bytes to evict
**/
virtual Input &evict(size_t bytes) = 0;
virtual ~Input();
};
} // namespace vespalib
|