-
Notifications
You must be signed in to change notification settings - Fork 3
/
HDF5DiskCache.h
42 lines (34 loc) · 1.67 KB
/
HDF5DiskCache.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
////////////////////////////////////////////////////////////////////////////
//// This file includes header files of the cache handling routines for the HDF4 handler.
//// The skeleton of the code is adapted from BESDapResponseCache.cc under bes/dap
//// Authors: MuQun Yang <myang6@hdfgroup.org>
//// Copyright (c) 2017 The HDF Group
///////////////////////////////////////////////////////////////////////////////
//
#ifndef _h5_disk_cache_h
#define _h5_disk_cache_h
#include <unistd.h>
#include <string>
#include <vector>
#include "BESFileLockingCache.h"
class HDF5DiskCache: public BESFileLockingCache
{
private:
static HDF5DiskCache *d_instance;
static void delete_instance() { delete d_instance; d_instance = 0; }
HDF5DiskCache(const unsigned long long,const std::string&, const std::string&);
public:
static const std::string PATH_KEY;
static const std::string SIZE_KEY;
static const std::string PREFIX_KEY;
virtual ~HDF5DiskCache() {}
static long getCacheSizeFromConfig(const long cache_size);
static std::string getCachePrefixFromConfig(const std::string&);
static std::string getCacheDirFromConfig(const std::string&);
bool is_valid(const std::string & cache_file_name, const int expected_file_size) const;
static HDF5DiskCache *get_instance(const long, const std::string&, const std::string&);
bool get_data_from_cache(const std::string &cache_file_name, const int expected_file_size,int &fd);
bool write_cached_data(const std::string &cache_file_name,const int expected_file_size,const std::vector<double> &val);
bool write_cached_data2(const std::string &cache_file_name,const int expected_file_size,const void *buf);
};
#endif