blob: dde8ce743b49b5ab4261c32ef1e5d115801c0620 (
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
|
#pragma once
#include <yt/cpp/mapreduce/interface/fwd.h>
#include <yt/yt/core/tracing/trace_context.h>
namespace NYT::NTracing {
////////////////////////////////////////////////////////////////////////////////
/// This wrapper is required because NYT::NTracing::TTraceContextPtr is NYT::TIntrusivePtr,
/// and, if we used this pointer in interfaces of `mapreduce/yt` client, a lot of users of this library
/// could get unexpected build errors that `TIntrusivePtr` is ambiguous
/// (from `::` namespace and from `::NYT::` namespace).
/// So we use this wrapper in our interfaces to avoid such problems for users.
struct TTraceContextWrapper
{
///
/// Construct wrapper from NYT::NTracing::TTraceContextPtr (NYT::TIntrusivePtr)
///
/// This constructor is implicit so users can transparently pass NYT::TIntrusivePtr to the functions of
/// mapreduce/yt client.
TTraceContextWrapper(const TTraceContextPtr& ptr)
: Ptr(ptr)
{ }
/// Wrapped pointer
TTraceContextPtr Ptr;
};
using TTraceContextWrapperPtr = std::shared_ptr<TTraceContextWrapper>;
TTraceContextWrapperPtr CreateTraceContext(const std::string& name, const TConfigPtr& config);
////////////////////////////////////////////////////////////////////////////////
} // namespace NYT::NTracing
|