1use std::time::Duration;
2
3use gbf_core::{
4 decompiler::function_decompiler::FunctionDecompilerErrorContext, utils::Gs2BytecodeAddress,
5};
6use serde::{Deserialize, Serialize};
7
8#[derive(Debug, Clone, Serialize, Deserialize)]
10pub struct GbfGraphvizStructureAnalaysisDao {
11 pub gbf_version: String,
13
14 pub module_id: String,
16
17 pub function_address: Gs2BytecodeAddress,
19
20 pub structure_analysis_step: usize,
22
23 pub dot_key: String,
25}
26
27impl GbfGraphvizStructureAnalaysisDao {
28 pub fn pk_key(&self) -> String {
29 "gbf_version#module_id#function_address".to_string()
30 }
31
32 pub fn pk_val(&self) -> String {
33 format!(
34 "{}#{}#{}",
35 self.gbf_version, self.module_id, self.function_address
36 )
37 }
38
39 pub fn dot_url(&self, bucket: &str) -> String {
40 format!("https://{}.s3.amazonaws.com/{}", bucket, self.dot_key)
41 }
42}
43
44#[derive(Debug, Clone, Serialize, Deserialize)]
46pub struct GbfVersionDao {
47 pub gbf_version: String,
49
50 pub total_time: Duration,
52
53 pub suite_timestamp: u64, }
56
57impl GbfVersionDao {
58 pub fn pk_key(&self) -> String {
59 "gbf_version".to_string()
60 }
61
62 pub fn pk_val(&self) -> String {
63 self.gbf_version.clone()
64 }
65}
66
67#[derive(Debug, Serialize, Deserialize)]
69pub struct GbfModuleDao {
70 pub gbf_version: String,
72
73 pub module_id: String,
75
76 pub file_name: String,
78
79 pub module_load_time: Duration,
81
82 pub decompile_success: bool,
84}
85
86impl GbfModuleDao {
87 pub fn pk_key(&self) -> String {
88 "gbf_version".to_string()
89 }
90
91 pub fn pk_val(&self) -> String {
92 self.gbf_version.to_string()
93 }
94}
95
96#[derive(Debug, Serialize, Deserialize, Clone)]
97pub struct GbfFunctionDao {
98 pub gbf_version: String,
100
101 pub module_id: String,
103
104 pub function_address: Gs2BytecodeAddress,
106
107 pub function_name: Option<String>,
109
110 pub decompile_success: bool,
112
113 pub decompile_result: Option<String>,
115
116 pub total_time: Duration,
118
119 pub dot_key: String,
121}
122
123impl GbfFunctionDao {
124 pub fn pk_key(&self) -> String {
125 "gbf_version#module_id".to_string()
126 }
127
128 pub fn pk_val(&self) -> String {
129 format!("{}#{}", self.gbf_version, self.module_id)
130 }
131
132 pub fn dot_url(&self, bucket: &str) -> String {
133 format!("https://{}.s3.amazonaws.com/{}", bucket, self.dot_key)
134 }
135}
136
137#[derive(Debug, Serialize, Clone)]
138pub struct GbfFunctionErrorDao {
139 pub gbf_version: String,
141
142 pub module_id: String,
144
145 pub function_address: Gs2BytecodeAddress,
147
148 pub error_type: String,
150
151 pub message: String,
153
154 pub backtrace: GbfSimplifiedBacktrace,
156
157 pub context: FunctionDecompilerErrorContext,
159}
160
161impl GbfFunctionErrorDao {
162 pub fn pk_key(&self) -> String {
163 "gbf_version#module_id".to_string()
164 }
165
166 pub fn pk_val(&self) -> String {
167 format!("{}#{}", self.gbf_version, self.module_id)
168 }
169}
170
171#[derive(Debug, Serialize, Deserialize, Clone)]
172pub struct GbfSimplifiedBacktrace {
173 pub frames: Vec<GbfSimplifiedBacktraceFrame>,
174}
175
176#[derive(Debug, Serialize, Deserialize, Clone)]
177pub struct GbfSimplifiedBacktraceFrame {
178 pub function: String,
179 pub file: String,
180 pub line: u32,
181}