OmniSciDB  cde582ebc3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RenderHandler.h
Go to the documentation of this file.
1 /*
2  * Copyright 2022 HEAVY.AI, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
23 #pragma once
24 
26 #include "gen-cpp/Heavy.h"
27 
28 class DBHandler;
29 
30 namespace Catalog_Namespace {
31 class SessionInfo;
32 }
33 
34 namespace QueryRenderer {
35 class QueryRenderManager;
36 } // namespace QueryRenderer
37 
38 namespace Parser {
39 class DDLStmt;
40 }
41 
43  public:
44  // forward declaration of the implementation class to be defined later.
45  // This is public as there can be certain functionality at lower levels that may want to
46  // work directly with the implementation layer.
47  class Impl;
48 
49  explicit RenderHandler(DBHandler* db_handler,
50  const size_t render_mem_bytes,
51  const size_t max_conncurrent_render_sessions,
52  const bool compositor_use_last_gpu,
53  const bool enable_auto_clear_render_mem,
54  const int render_oom_retry_threshold,
55  const bool renderer_use_ppll_polys,
56  const bool renderer_prefer_igpu,
57  const uint32_t renderer_vulkan_timeout_ms,
58  const SystemParameters system_parameters);
60 
61  private:
62  void disconnect(const TSessionId& session);
63  void render_vega(TRenderResult& _return,
64  const std::shared_ptr<Catalog_Namespace::SessionInfo> session_info,
65  const int64_t widget_id,
66  std::string&& vega_json,
67  const int32_t compression_level,
68  const std::string& nonce);
69 
70  void start_render_query(TPendingRenderQuery& _return,
71  const TSessionId& session,
72  const int64_t widget_id,
73  const int16_t node_idx,
74  std::string&& vega_json);
75 
76  void execute_next_render_step(TRenderStepResult& _return,
77  const TPendingRenderQuery& pending_render,
78  const TRenderAggDataMap& merged_data);
79 
81  TPixelTableRowResult& _return,
82  const std::shared_ptr<Catalog_Namespace::SessionInfo> session_info,
83  const int64_t widget_id,
84  const TPixel& pixel,
85  const std::map<std::string, std::vector<std::string>>& table_col_names,
86  const bool column_format,
87  const int32_t pixelRadius,
88  const std::string& nonce);
89 
90  void clear_gpu_memory();
91  void clear_cpu_memory();
92 
93  std::string get_renderer_status_json() const;
94  bool validate_renderer_status_json(const std::string& other_renderer_status_json) const;
95 
96  void shutdown();
97 
98  std::unique_ptr<Impl> impl_;
99 
100  friend class DBHandler;
101 };
void clear_cpu_memory()
void execute_next_render_step(TRenderStepResult &_return, const TPendingRenderQuery &pending_render, const TRenderAggDataMap &merged_data)
void disconnect(const TSessionId &session)
void start_render_query(TPendingRenderQuery &_return, const TSessionId &session, const int64_t widget_id, const int16_t node_idx, std::string &&vega_json)
void get_result_row_for_pixel(TPixelTableRowResult &_return, const std::shared_ptr< Catalog_Namespace::SessionInfo > session_info, const int64_t widget_id, const TPixel &pixel, const std::map< std::string, std::vector< std::string >> &table_col_names, const bool column_format, const int32_t pixelRadius, const std::string &nonce)
std::unique_ptr< Impl > impl_
Definition: RenderHandler.h:98
void clear_gpu_memory()
RenderHandler(DBHandler *db_handler, const size_t render_mem_bytes, const size_t max_conncurrent_render_sessions, const bool compositor_use_last_gpu, const bool enable_auto_clear_render_mem, const int render_oom_retry_threshold, const bool renderer_use_ppll_polys, const bool renderer_prefer_igpu, const uint32_t renderer_vulkan_timeout_ms, const SystemParameters system_parameters)
std::string get_renderer_status_json() const
bool validate_renderer_status_json(const std::string &other_renderer_status_json) const
void render_vega(TRenderResult &_return, const std::shared_ptr< Catalog_Namespace::SessionInfo > session_info, const int64_t widget_id, std::string &&vega_json, const int32_t compression_level, const std::string &nonce)