Scanner C++ API
column_source.h
1 /* Copyright 2018 Carnegie Mellon University
2  *
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include "scanner/api/source.h"
17 
18 #include "storehouse/storage_backend.h"
19 #include "scanner/engine/video_index_entry.h"
20 #include "scanner/engine/table_meta_cache.h"
21 
22 #include <glog/logging.h>
23 #include <vector>
24 
25 namespace scanner {
26 namespace internal {
27 
28 class ColumnSource : public Source {
29  public:
30  ColumnSource(const SourceConfig& config);
31 
32  void read(const std::vector<ElementArgs>& element_args,
33  std::vector<Elements>& output_columns) override;
34 
35  void get_video_column_information(
36  proto::VideoDescriptor::VideoCodecType& encoding_type,
37  bool& inplace_video);
38 
39  void set_table_meta(TableMetaCache* cache);
40 
41  private:
42  Result valid_;
43  i32 load_sparsity_threshold_;
44  TableMetaCache* table_metadata_; // Caching table metadata
45  std::unique_ptr<storehouse::StorageBackend>
46  storage_; // Setup a distinct storage backend for each IO thread
47 
48  // To ammortize opening files
49  i32 last_table_id_ = -1;
50  std::map<std::tuple<i32, i32, i32>, VideoIndexEntry> index_;
51 
52  // Video Column Information
53  proto::VideoDescriptor::VideoCodecType codec_type_;
54  bool inplace_video_;
55 };
56 
57 }
58 } // namespace scanner
Definition: video_index_entry.h:27
Parameters provided at instantiation of Source node.
Definition: source.h:29
Interface for reading data in a computation graph.
Definition: source.h:43
Definition: column_source.h:28
Definition: database.cpp:36
Definition: table_meta_cache.h:26