bes  Updated for version 3.17.0
BESUncompressCache.h
1 // This file is part of bes, A C++ back-end server implementation framework
2 // for the OPeNDAP Data Access Protocol.
3 
4 // Copyright (c) 2015 OPeNDAP, Inc
5 // Author: Nathan Potter <npotter@opendap.org>
6 //
7 // This library is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU Lesser General Public
9 // License as published by the Free Software Foundation; either
10 // version 2.1 of the License, or (at your option) any later version.
11 //
12 // This library is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 // Lesser General Public License for more details.
16 //
17 // You should have received a copy of the GNU Lesser General Public
18 // License along with this library; if not, write to the Free Software
19 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 
21 #ifndef DISPATCH_BESUNCOMPRESSCACHE_H_
22 #define DISPATCH_BESUNCOMPRESSCACHE_H_
23 
24 #include "BESFileLockingCache.h"
25 
27 private:
28  static BESUncompressCache * d_instance;
29  static void delete_instance()
30  {
31  delete d_instance;
32  d_instance = 0;
33  }
34 
35  string d_dimCacheDir;
36  string d_dataRootDir;
37  string d_dimCacheFilePrefix;
38  unsigned long d_maxCacheSize;
39 
42 
43  bool is_valid(const std::string &cache_file_name, const std::string &dataset_file_name);
44 
45  static string getCacheDirFromConfig();
46  static string getCachePrefixFromConfig();
47  static unsigned long getCacheSizeFromConfig();
48 
49 protected:
50 
51  BESUncompressCache(const string &data_root_dir, const string &cache_dir, const string &prefix,
52  unsigned long long size);
53 
54 public:
55  static const string DIR_KEY;
56  static const string PREFIX_KEY;
57  static const string SIZE_KEY;
58 
59  static BESUncompressCache *get_instance(const string &bes_catalog_root_dir, const string &cache_dir,
60  const string &prefix, unsigned long long size);
62 
63  virtual string get_cache_file_name(const string &src, bool mangle = true);
64 
65  virtual ~BESUncompressCache();
66 };
67 
68 #endif /* DISPATCH_BESUNCOMPRESSCACHE_H_ */
Implementation of a caching mechanism for compressed data. This cache uses simple advisory locking fo...
virtual string get_cache_file_name(const string &src, bool mangle=true)
Build the name of file that will holds the uncompressed data from &#39;src&#39; in the cache.
static BESUncompressCache * get_instance()