blob: 08e765b3d05087746a2719c9cbf765760807da74 (
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
100
|
#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.
////////////////////////////////////////////////////////////////////////////////
struct TBridgeYqlPluginOptions
{
const char* MRJobBinary;
const char* UdfDirectory;
struct TBridgeCluster
{
const char* Cluster;
const char* Proxy;
};
ssize_t ClusterCount;
TBridgeCluster* Clusters;
const char* DefaultCluster;
const char* OperationAttributes;
ssize_t OperationAttributesLength = 0;
ssize_t MaxFilesSizeMb;
ssize_t MaxFileCount;
ssize_t DownloadFileRetryCount;
const char* YTTokenPath;
// 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;
};
// 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;
size_t NameLength = 0;
const char* Content;
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)
////////////////////////////////////////////////////////////////////////////////
|