File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -46,16 +46,23 @@ struct MemoryTierConfig : public JSONConfig {
46
46
47
47
explicit MemoryTierConfig (const folly::dynamic& configJson);
48
48
MemoryTierCacheConfig getMemoryTierCacheConfig () {
49
- if (file.empty ()) {
50
- throw std::invalid_argument (" Please specify valid path to memory mapped file." );
51
- }
52
- MemoryTierCacheConfig config = MemoryTierCacheConfig::fromFile (file).setSize (size).setRatio (ratio);
49
+ MemoryTierCacheConfig config = memoryTierCacheConfigFromSource ();
50
+ config.setSize (size).setRatio (ratio);
53
51
return config;
54
52
}
55
53
56
54
std::string file{" " };
57
55
size_t ratio{0 };
58
56
size_t size{0 };
57
+
58
+ private:
59
+ MemoryTierCacheConfig memoryTierCacheConfigFromSource () {
60
+ if (file.empty ()) {
61
+ return MemoryTierCacheConfig::fromShm ();
62
+ } else {
63
+ return MemoryTierCacheConfig::fromFile (file);
64
+ }
65
+ }
59
66
};
60
67
61
68
struct CacheConfig : public JSONConfig {
You can’t perform that action at this time.
0 commit comments