]> git.proxmox.com Git - ceph.git/blame - ceph/src/jaegertracing/opentelemetry-cpp/api/include/opentelemetry/common/key_value_iterable.h
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / jaegertracing / opentelemetry-cpp / api / include / opentelemetry / common / key_value_iterable.h
CommitLineData
1e59de90
TL
1// Copyright The OpenTelemetry Authors
2// SPDX-License-Identifier: Apache-2.0
3
4#pragma once
5
6#include "opentelemetry/common/attribute_value.h"
7#include "opentelemetry/nostd/function_ref.h"
8#include "opentelemetry/version.h"
9
10OPENTELEMETRY_BEGIN_NAMESPACE
11namespace common
12{
13/**
14 * Supports internal iteration over a collection of key-value pairs.
15 */
16class KeyValueIterable
17{
18public:
19 virtual ~KeyValueIterable() = default;
20
21 /**
22 * Iterate over key-value pairs
23 * @param callback a callback to invoke for each key-value. If the callback returns false,
24 * the iteration is aborted.
25 * @return true if every key-value pair was iterated over
26 */
27 virtual bool ForEachKeyValue(nostd::function_ref<bool(nostd::string_view, common::AttributeValue)>
28 callback) const noexcept = 0;
29
30 /**
31 * @return the number of key-value pairs
32 */
33 virtual size_t size() const noexcept = 0;
34};
35} // namespace common
36OPENTELEMETRY_END_NAMESPACE