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