aboutsummaryrefslogtreecommitdiffstats
path: root/vbench/src/vbench/vbench/request_generator.h
blob: c17ff1ad23ccdcfc5b2cde4718beab5c34e57771 (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
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include "generator.h"
#include "request.h"
#include <vbench/core/input_file_reader.h>
#include <vbench/core/handler.h>

namespace vbench {

/**
 * Reads lines from an input file and generates requests that are
 * passed to a request handler.
 **/
class RequestGenerator : public Generator
{
private:
    InputFileReader   _input;
    Handler<Request> &_next;
    bool              _aborted;

public:
    RequestGenerator(const string &inputFile, Handler<Request> &next);
    ~RequestGenerator() override;
    void abort() override;
    void run() override;
    const Taint &tainted() const override { return _input.tainted(); }
};

} // namespace vbench