blob: 4905264965d2adccfc41f22e855c3bb736ff3480 (
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
#pragma once
#include <unistd.h>
////////////////////////////////////////////////////////////////////////////////
// This is a plain C version of an interface described in yt/yql/plugin/plugin.h.
// All strings without separate length field are assumed to be null-terminated.
////////////////////////////////////////////////////////////////////////////////
// NB(mpereskokova): don't forget to update min_required_abi_version at yt/yql/agent/config.cpp and abi_version in yt/yql/plugin/dynamic/impl.cpp during breaking changes
using TFuncBridgeGetAbiVersion = ssize_t();
////////////////////////////////////////////////////////////////////////////////
struct TBridgeYqlPluginOptions
{
const char* SingletonsConfig = nullptr;
ssize_t SingletonsConfigLength = 0;
const char* GatewayConfig = nullptr;
size_t GatewayConfigLength = 0;
const char* FileStorageConfig = nullptr;
size_t FileStorageConfigLength = 0;
const char* OperationAttributes = nullptr;
size_t OperationAttributesLength = 0;
const char* YTTokenPath = nullptr;
// TODO(max42): passing C++ objects across shared libraries is incredibly
// fragile. This is a temporary mean until we come up with something more
// convenient; get rid of this ASAP.
using TLogBackendHolder = void;
TLogBackendHolder* LogBackend = nullptr;
};
// Opaque type representing a YQL plugin.
using TBridgeYqlPlugin = void;
using TFuncBridgeCreateYqlPlugin = TBridgeYqlPlugin*(const TBridgeYqlPluginOptions* options);
using TFuncBridgeFreeYqlPlugin = void(TBridgeYqlPlugin* plugin);
////////////////////////////////////////////////////////////////////////////////
// TODO(max42): consider making structure an opaque type with accessors a-la
// const char* BridgeGetYsonResult(const TBridgeQueryResult*). This would remove the need
// to manually free string data.
struct TBridgeQueryResult
{
const char* YsonResult = nullptr;
ssize_t YsonResultLength = 0;
const char* Plan = nullptr;
ssize_t PlanLength = 0;
const char* Statistics = nullptr;
ssize_t StatisticsLength = 0;
const char* Progress = nullptr;
ssize_t ProgressLength = 0;
const char* TaskInfo = nullptr;
ssize_t TaskInfoLength = 0;
const char* YsonError = nullptr;
ssize_t YsonErrorLength = 0;
};
enum EQueryFileContentType
{
RawInlineData,
Url,
};
struct TBridgeQueryFile
{
const char* Name = nullptr;
size_t NameLength = 0;
const char* Content = nullptr;
size_t ContentLength = 0;
EQueryFileContentType Type;
};
using TFuncBridgeFreeQueryResult = void(TBridgeQueryResult* result);
using TFuncBridgeRun = TBridgeQueryResult*(TBridgeYqlPlugin* plugin, const char* queryId, const char* impersonationUser, const char* queryText, const char* settings, const TBridgeQueryFile* files, int fileCount);
using TFuncBridgeGetProgress = TBridgeQueryResult*(TBridgeYqlPlugin* plugin, const char* queryId);
////////////////////////////////////////////////////////////////////////////////
#define FOR_EACH_BRIDGE_INTERFACE_FUNCTION(XX) \
XX(BridgeCreateYqlPlugin) \
XX(BridgeFreeYqlPlugin) \
XX(BridgeFreeQueryResult) \
XX(BridgeRun) \
XX(BridgeGetProgress) \
XX(BridgeGetAbiVersion)
////////////////////////////////////////////////////////////////////////////////
|