1
#pragma once
2

            
3
#include <chrono>
4
#include <memory>
5

            
6
#include "envoy/common/pure.h"
7

            
8
namespace Envoy {
9
namespace Stats {
10

            
11
/**
12
 * An abstraction of timespan which can be completed.
13
 */
14
class CompletableTimespan {
15
public:
16
244675
  virtual ~CompletableTimespan() = default;
17

            
18
  /**
19
   * Time elapsed since the creation of the timespan.
20
   */
21
  virtual std::chrono::milliseconds elapsed() const PURE;
22

            
23
  /**
24
   * Complete the timespan.
25
   */
26
  virtual void complete() PURE;
27
};
28

            
29
using Timespan = CompletableTimespan;
30
using TimespanPtr = std::unique_ptr<Timespan>;
31

            
32
} // namespace Stats
33
} // namespace Envoy