summaryrefslogtreecommitdiffstats
path: root/src/common/ThrottleInterface.h
blob: 49182a1172b06c49f3e7cad79c7352e1364563f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab

#pragma once

#include <cstdint>

class ThrottleInterface {
public:
  virtual ~ThrottleInterface() {}
  /**
   * take the specified number of slots from the stock regardless the throttling
   * @param c number of slots to take
   * @returns the total number of taken slots
   */
  virtual int64_t take(int64_t c = 1) = 0;
  /**
   * put slots back to the stock
   * @param c number of slots to return
   * @returns number of requests being hold after this
   */
  virtual int64_t put(int64_t c = 1) = 0;
};