8
8
use std:: cmp;
9
9
10
10
use amalthea:: comm:: comm_channel:: CommMsg ;
11
- use amalthea:: comm:: data_tool_comm :: ColumnSchema ;
12
- use amalthea:: comm:: data_tool_comm :: ColumnSchemaTypeDisplay ;
13
- use amalthea:: comm:: data_tool_comm :: DataToolBackendReply ;
14
- use amalthea:: comm:: data_tool_comm :: DataToolBackendRequest ;
15
- use amalthea:: comm:: data_tool_comm :: GetColumnProfileParams ;
16
- use amalthea:: comm:: data_tool_comm :: GetDataValuesParams ;
17
- use amalthea:: comm:: data_tool_comm :: GetSchemaParams ;
18
- use amalthea:: comm:: data_tool_comm :: SetColumnFiltersParams ;
19
- use amalthea:: comm:: data_tool_comm :: SetSortColumnsParams ;
20
- use amalthea:: comm:: data_tool_comm :: TableData ;
21
- use amalthea:: comm:: data_tool_comm :: TableSchema ;
11
+ use amalthea:: comm:: data_explorer_comm :: ColumnSchema ;
12
+ use amalthea:: comm:: data_explorer_comm :: ColumnSchemaTypeDisplay ;
13
+ use amalthea:: comm:: data_explorer_comm :: DataExplorerBackendReply ;
14
+ use amalthea:: comm:: data_explorer_comm :: DataExplorerBackendRequest ;
15
+ use amalthea:: comm:: data_explorer_comm :: GetColumnProfileParams ;
16
+ use amalthea:: comm:: data_explorer_comm :: GetDataValuesParams ;
17
+ use amalthea:: comm:: data_explorer_comm :: GetSchemaParams ;
18
+ use amalthea:: comm:: data_explorer_comm :: SetColumnFiltersParams ;
19
+ use amalthea:: comm:: data_explorer_comm :: SetSortColumnsParams ;
20
+ use amalthea:: comm:: data_explorer_comm :: TableData ;
21
+ use amalthea:: comm:: data_explorer_comm :: TableSchema ;
22
22
use amalthea:: comm:: event:: CommManagerEvent ;
23
23
use amalthea:: socket:: comm:: CommInitiator ;
24
24
use amalthea:: socket:: comm:: CommSocket ;
@@ -45,7 +45,7 @@ use crate::r_task;
45
45
use crate :: thread:: RThreadSafe ;
46
46
use crate :: variables:: variable:: WorkspaceVariableDisplayType ;
47
47
48
- pub struct RDataTool {
48
+ pub struct RDataExplorer {
49
49
title : String ,
50
50
table : RThreadSafe < RObject > ,
51
51
comm : CommSocket ,
@@ -57,7 +57,7 @@ struct Metadata {
57
57
title : String ,
58
58
}
59
59
60
- impl RDataTool {
60
+ impl RDataExplorer {
61
61
pub fn start (
62
62
title : String ,
63
63
data : RObject ,
@@ -68,7 +68,7 @@ impl RDataTool {
68
68
let comm = CommSocket :: new (
69
69
CommInitiator :: BackEnd ,
70
70
id. clone ( ) ,
71
- String :: from ( "positron.dataTool " ) ,
71
+ String :: from ( "positron.dataExplorer " ) ,
72
72
) ;
73
73
74
74
// To be able to `Send` the `data` to the thread to be owned by the data
@@ -136,50 +136,50 @@ impl RDataTool {
136
136
}
137
137
}
138
138
139
- fn handle_rpc ( & self , req : DataToolBackendRequest ) -> anyhow:: Result < DataToolBackendReply > {
139
+ fn handle_rpc ( & self , req : DataExplorerBackendRequest ) -> anyhow:: Result < DataExplorerBackendReply > {
140
140
match req {
141
- DataToolBackendRequest :: GetSchema ( GetSchemaParams {
141
+ DataExplorerBackendRequest :: GetSchema ( GetSchemaParams {
142
142
start_index,
143
143
num_columns,
144
144
} ) => {
145
145
// TODO: Support for data frames with over 2B rows
146
146
// TODO: Check bounds
147
147
r_task ( || self . r_get_schema ( start_index as i32 , num_columns as i32 ) )
148
148
} ,
149
- DataToolBackendRequest :: GetDataValues ( GetDataValuesParams {
149
+ DataExplorerBackendRequest :: GetDataValues ( GetDataValuesParams {
150
150
row_start_index,
151
151
num_rows,
152
152
column_indices,
153
153
} ) => {
154
154
// Fetch stringified data values and return
155
155
r_task ( || self . r_get_data_values ( row_start_index, num_rows, column_indices) )
156
156
} ,
157
- DataToolBackendRequest :: SetSortColumns ( SetSortColumnsParams { sort_keys : _ } ) => {
157
+ DataExplorerBackendRequest :: SetSortColumns ( SetSortColumnsParams { sort_keys : _ } ) => {
158
158
bail ! ( "Data Viewer: Not yet implemented" )
159
159
} ,
160
- DataToolBackendRequest :: SetColumnFilters ( SetColumnFiltersParams { filters : _ } ) => {
160
+ DataExplorerBackendRequest :: SetColumnFilters ( SetColumnFiltersParams { filters : _ } ) => {
161
161
bail ! ( "Data Viewer: Not yet implemented" )
162
162
} ,
163
- DataToolBackendRequest :: GetColumnProfile ( GetColumnProfileParams {
163
+ DataExplorerBackendRequest :: GetColumnProfile ( GetColumnProfileParams {
164
164
profile_type : _,
165
165
column_index : _,
166
166
} ) => {
167
167
bail ! ( "Data Viewer: Not yet implemented" )
168
168
} ,
169
- DataToolBackendRequest :: GetState => {
169
+ DataExplorerBackendRequest :: GetState => {
170
170
bail ! ( "Data Viewer: Not yet implemented" )
171
171
} ,
172
172
}
173
173
}
174
174
}
175
175
176
176
// Methods that must be run on the main R thread
177
- impl RDataTool {
177
+ impl RDataExplorer {
178
178
fn r_get_schema (
179
179
& self ,
180
180
start_index : i32 ,
181
181
num_columns : i32 ,
182
- ) -> anyhow:: Result < DataToolBackendReply > {
182
+ ) -> anyhow:: Result < DataExplorerBackendReply > {
183
183
unsafe {
184
184
let table = self . table . get ( ) . clone ( ) ;
185
185
let object = * table;
@@ -233,7 +233,7 @@ impl RDataTool {
233
233
total_num_columns : total_num_columns as i64 ,
234
234
} ;
235
235
236
- Ok ( DataToolBackendReply :: GetSchemaReply ( response) )
236
+ Ok ( DataExplorerBackendReply :: GetSchemaReply ( response) )
237
237
}
238
238
}
239
239
@@ -242,7 +242,7 @@ impl RDataTool {
242
242
row_start_index : i64 ,
243
243
num_rows : i64 ,
244
244
column_indices : Vec < i64 > ,
245
- ) -> anyhow:: Result < DataToolBackendReply > {
245
+ ) -> anyhow:: Result < DataExplorerBackendReply > {
246
246
unsafe {
247
247
let table = self . table . get ( ) . clone ( ) ;
248
248
let object = * table;
@@ -297,7 +297,7 @@ impl RDataTool {
297
297
row_labels : Some ( vec ! [ row_labels] ) ,
298
298
} ;
299
299
300
- Ok ( DataToolBackendReply :: GetDataValuesReply ( response) )
300
+ Ok ( DataExplorerBackendReply :: GetDataValuesReply ( response) )
301
301
}
302
302
}
303
303
}
@@ -373,7 +373,7 @@ pub unsafe extern "C" fn ps_view_data_frame(x: SEXP, title: SEXP) -> anyhow::Res
373
373
let main = RMain :: get ( ) ;
374
374
let comm_manager_tx = main. get_comm_manager_tx ( ) . clone ( ) ;
375
375
376
- RDataTool :: start ( title, x, comm_manager_tx) ?;
376
+ RDataExplorer :: start ( title, x, comm_manager_tx) ?;
377
377
378
378
Ok ( R_NilValue )
379
379
}
0 commit comments