1
#pragma once
2

            
3
#include <cstdint>
4

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

            
7
#include "absl/types/optional.h"
8

            
9
namespace Envoy {
10

            
11
/**
12
 * Interface for hashable types used in heterogeneous contexts (see, for example, usage in
13
 * FilterStateHashMethod).
14
 */
15
class Hashable {
16
public:
17
16
  virtual ~Hashable() = default;
18

            
19
  /**
20
   * Request the 64-bit hash for this object.
21
   * @return absl::optional<uint64_t> the hash value, or absl::nullopt if a hash could not be
22
   * produced for this instance.
23
   */
24
  virtual absl::optional<uint64_t> hash() const PURE;
25
};
26

            
27
} // namespace Envoy