bes Updated for version 3.21.1
The Backend Server (BES) is the lower two tiers of the Hyrax data server
BESH4MCache.h
1
7//
8#ifndef _bes_h4m_cache_h
9#define _bes_h4m_cache_h
10
11#include <unistd.h>
12#include <string>
13#include <vector>
14#include "BESFileLockingCache.h"
15
16class BESH4Cache: public BESFileLockingCache
17{
18private:
19 static bool d_enabled;
20 static BESH4Cache *d_instance;
21 static void delete_instance() { delete d_instance; d_instance = nullptr; }
22
23 BESH4Cache();
24
25public:
26 static const std::string PATH_KEY;
27 static const std::string PREFIX_KEY;
28 static const std::string SIZE_KEY;
29 ~BESH4Cache() override = default;
30
31 static long getCacheSizeFromConfig();
32 static std::string getCachePrefixFromConfig();
33 static std::string getCacheDirFromConfig();
34
35 bool is_valid(const std::string & cache_file_name, const int expected_file_size) const;
36 static BESH4Cache *get_instance();
37 bool get_data_from_cache(const std::string &cache_file_name, const int expected_file_size,int &fd);
38 bool write_cached_data(const std::string &cache_file_name,const int expected_file_size,const std::vector<double> &val);
39 bool write_cached_data2(const std::string &cache_file_name,const int expected_file_size,const void *buf);
40};
41
42#endif
43
static BESH4Cache * get_instance()