OmniSciDB  a987f07e93
 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 
29 
30 class DBHandler;
31 
32 namespace Catalog_Namespace {
33 class SessionInfo;
34 }
35 
36 namespace QueryRenderer {
37 class QueryRenderManager;
38 } // namespace QueryRenderer
39 
40 namespace Parser {
41 class DDLStmt;
42 }
43 
45  public:
46  // forward declaration of the implementation class to be defined later.
47  // This is public as there can be certain functionality at lower levels that may want to
48  // work directly with the implementation layer.
49  class Impl;
50 
51  explicit RenderHandler(DBHandler* db_handler,
52  const size_t render_mem_bytes,
53  const size_t max_conncurrent_render_sessions,
54  const bool compositor_use_last_gpu,
55  const bool enable_auto_clear_render_mem,
56  const int render_oom_retry_threshold,
57  const bool renderer_use_ppll_polys,
58  const bool renderer_prefer_igpu,
59  const uint32_t renderer_vulkan_timeout_ms,
60  const bool renderer_use_parallel_executors,
61  const SystemParameters system_parameters);
63 
64  private:
65  void disconnect(const TSessionId& session);
66  void render_vega(TRenderResult& _return,
67  const std::shared_ptr<Catalog_Namespace::SessionInfo> session_info,
68  const int64_t widget_id,
69  std::string&& vega_json,
70  const int32_t compression_level,
71  const std::string& nonce);
72 
73  void start_render_query(TPendingRenderQuery& _return,
74  const TSessionId& session,
75  const int64_t widget_id,
76  const int16_t node_idx,
77  std::string&& vega_json);
78 
79  void execute_next_render_step(TRenderStepResult& _return,
80  const TPendingRenderQuery& pending_render,
81  const TRenderAggDataMap& merged_data);
82 
84  TPixelTableRowResult& _return,
85  const std::shared_ptr<Catalog_Namespace::SessionInfo> session_info,
86  const int64_t widget_id,
87  const TPixel& pixel,
88  const std::map<std::string, std::vector<std::string>>& table_col_names,
89  const bool column_format,
90  const int32_t pixelRadius,
91  const std::string& nonce);
92 
93  void clear_gpu_memory();
94  void clear_cpu_memory();
95 
96  std::string get_renderer_status_json() const;
97  bool validate_renderer_status_json(const std::string& other_renderer_status_json) const;
98 
99  void shutdown();
100 
101  std::unique_ptr<Impl> impl_;
102 
103  friend class DBHandler;
104 };
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 bool renderer_use_parallel_executors, const SystemParameters system_parameters)
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_
void clear_gpu_memory()
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)