#pragma once #include #include #include #include #include #include #include namespace NYT::NYqlPlugin { using namespace NYson; //////////////////////////////////////////////////////////////////////////////// using TQueryId = TGuid; //////////////////////////////////////////////////////////////////////////////// class TYqlPluginOptions { public: TYsonString SingletonsConfig; TYsonString GatewayConfig; TYsonString FileStorageConfig; TYsonString OperationAttributes; TString YTTokenPath; THolder LogBackend; std::optional YqlPluginSharedLibrary; }; struct TQueryResult { std::optional YsonResult; std::optional Plan; std::optional Statistics; std::optional Progress; std::optional TaskInfo; //! YSON representation of a YT error. std::optional YsonError; }; struct TQueryFile { TStringBuf Name; TStringBuf Content; EQueryFileContentType Type; }; //! This interface encapsulates YT <-> YQL integration. //! There are two major implementation: one of them is based //! on YQL code and another wraps the pure C bridge interface, which //! is implemented by a dynamic library. /*! * \note Thread affinity: any */ struct IYqlPlugin { virtual TQueryResult Run(TQueryId queryId, TString impersonationUser, TString queryText, TYsonString settings, std::vector files) noexcept = 0; virtual TQueryResult GetProgress(TQueryId queryId) noexcept = 0; virtual ~IYqlPlugin() = default; }; //////////////////////////////////////////////////////////////////////////////// Y_WEAK std::unique_ptr CreateYqlPlugin(TYqlPluginOptions& options) noexcept; //////////////////////////////////////////////////////////////////////////////// } // namespace NYT::NYqlPlugin