blob: bbf7f9b166305bac3f93a0c7cd48eabe42322695 (
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
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include <vespa/vespalib/stllike/string.h>
namespace proton {
/**
* Interface used to deny write operations when resource limits are reached.
*/
struct IResourceWriteFilter
{
class State
{
private:
bool _acceptWriteOperation;
vespalib::string _message;
public:
State()
: _acceptWriteOperation(true),
_message()
{}
State(bool acceptWriteOperation_, const vespalib::string &message_)
: _acceptWriteOperation(acceptWriteOperation_),
_message(message_)
{}
bool acceptWriteOperation() const { return _acceptWriteOperation; }
const vespalib::string &message() const { return _message; }
};
virtual ~IResourceWriteFilter() {}
virtual bool acceptWriteOperation() const = 0;
virtual State getAcceptState() const = 0;
};
} // namespace proton
|