JODA  0.13.1 (59b41972)
JSON On-Demand Analysis
config.h
Go to the documentation of this file.
1 //
2 // Created by Nico Schäfer on 3/22/17.
3 //
4 
5 #ifndef JODA_CONFIG_H
6 
7 #define JODA_CONFIG_H
8 
9 #define JSON_CONTAINER_DEFAULT_SIZE (50 * 1024 * 1024) // 50MB
10 #define JSON_STORAGE_DEFAULT_THREADS \
11  std::max(1u, std::thread::hardware_concurrency() - 1)
12 
13 #include <istream>
14 #include <string>
15 
16 class config {
17  public:
18  // Indices
19  static bool queryCache;
20 
21  // Bloom
22  static bool bloom_enabled;
23  static uint bloom_count; // How many elements roughly do we expect to insert?
24  static double
25  bloom_prob; // Maximum tolerable false positive probability? (0,1)
26 
27  // Directories
28  static std::string home;
29  static std::string tmpdir;
30 
31  // Storage
32  static bool storeJson;
33  static unsigned long long maxmemory;
37  LRU,
40  EXPLORER
41  };
42  static EvictionStrategies evictionStrategy; // Which eviction strategy to use
43 
44  // Benchmark
45  static bool benchmark;
46  static std::string benchfile;
47 
48  // Containers
49  static size_t JSONContainerSize;
50  static double chunk_size;
51  static double text_binary_mod;
52 
53  // Multithreading
54  static size_t storageRetrievalThreads;
55  static size_t parsingThreads;
56  static size_t readingThreads;
57 
58  // Parsing
59  static size_t read_bulk_size;
60  static std::string read_reader;
61  static size_t parse_bulk_size;
62 
63  // Similarity
64  static size_t
65  sim_min_cont_size; // Minimum container size (smaller will be merged)
66  static double
67  sim_min_similarity; // Minimum similarity required to merge documents
69 
70  static Sim_Measures sim_measure; // Which similarity measure to use
71  static bool sim_merge_on_parse;
72 
73  // History
74  static std::string history_file;
75  static bool persistent_history;
76  static int history_size;
77 
78  // CLI
80 
81  // View
82  static bool enable_views;
83  static bool enable_views_vo;
84 };
85 
86 inline std::istream& operator>>(std::istream& in, config::Sim_Measures& unit) {
87  std::string token;
88  in >> token;
89  if (token == "NO_SIMILARITY")
90  unit = config::NO_SIMILARITY;
91  else if (token == "PATH_JACCARD")
92  unit = config::PATH_JACCARD;
93  else if (token == "ATTRIBUTE_JACCARD")
95  else
96  in.setstate(std::ios_base::failbit);
97  return in;
98 }
99 
100 inline std::istream& operator>>(std::istream& in,
101  config::EvictionStrategies& eviction) {
102  std::string token;
103  in >> token;
104  if (token == "NO_EVICTION")
105  eviction = config::NO_EVICTION;
106  else if (token == "LARGEST")
107  eviction = config::LARGEST;
108  else if (token == "LRU")
109  eviction = config::LRU;
110  else if (token == "FIFO")
111  eviction = config::FIFO;
112  else if (token == "DEPENDENCIES")
113  eviction = config::DEPENDENCIES;
114  else if (token == "EXPLORER")
115  eviction = config::EXPLORER;
116  else
117  in.setstate(std::ios_base::failbit);
118  return in;
119 }
120 
121 #endif // JODA_CONFIG_H
Definition: config.h:16
static bool persistent_history
Definition: config.h:75
static std::string history_file
Definition: config.h:74
static size_t sim_min_cont_size
Definition: config.h:65
static bool benchmark
Definition: config.h:45
static unsigned long long maxmemory
Definition: config.h:33
static std::string read_reader
Definition: config.h:60
static std::string benchfile
Definition: config.h:46
static size_t JSONContainerSize
Definition: config.h:49
static uint bloom_count
Definition: config.h:23
Sim_Measures
Definition: config.h:68
@ PATH_JACCARD
Definition: config.h:68
@ ATTRIBUTE_JACCARD
Definition: config.h:68
@ NO_SIMILARITY
Definition: config.h:68
static std::string home
Definition: config.h:28
static bool storeJson
Definition: config.h:32
static std::string tmpdir
Definition: config.h:29
static bool sim_merge_on_parse
Definition: config.h:71
static size_t parsingThreads
Definition: config.h:55
static bool queryCache
Definition: config.h:19
static int history_size
Definition: config.h:76
static bool bloom_enabled
Definition: config.h:22
static double text_binary_mod
Definition: config.h:51
static bool enable_views
Definition: config.h:82
static double sim_min_similarity
Definition: config.h:67
static size_t readingThreads
Definition: config.h:56
static Sim_Measures sim_measure
Definition: config.h:70
static size_t read_bulk_size
Definition: config.h:59
static EvictionStrategies evictionStrategy
Definition: config.h:42
static bool enable_views_vo
Definition: config.h:83
static bool disable_interactive_CLI
Definition: config.h:79
static double chunk_size
Definition: config.h:50
static double bloom_prob
Definition: config.h:25
static size_t parse_bulk_size
Definition: config.h:61
EvictionStrategies
Definition: config.h:34
@ EXPLORER
Definition: config.h:40
@ LARGEST
Definition: config.h:36
@ DEPENDENCIES
Definition: config.h:39
@ NO_EVICTION
Definition: config.h:35
@ FIFO
Definition: config.h:38
@ LRU
Definition: config.h:37
static size_t storageRetrievalThreads
Definition: config.h:54
std::istream & operator>>(std::istream &in, config::Sim_Measures &unit)
Definition: config.h:86