bes Updated for version 3.21.1
The Backend Server (BES) is the lower two tiers of the Hyrax data server
DmrppRequestHandler.h
1// DmrppRequestHandler.h
2
3// Copyright (c) 2016 OPeNDAP, Inc. Author: James Gallagher
4// <jgallagher@opendap.org>, Patrick West <pwest@opendap.org>
5// Nathan Potter <npotter@opendap.org>
6//
7// modify it under the terms of the GNU Lesser General Public License
8// as published by the Free Software Foundation; either version 2.1 of
9// the License, or (at your option) any later version.
10//
11// This library is distributed in the hope that it will be useful, but
12// WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14// Lesser General Public License for more details.
15//
16// License along with this library; if not, write to the Free Software
17// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18// 02110-1301 U\ SA
19//
20// You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI.
21// 02874-0112.
22
23#ifndef I_DmrppRequestHandler_H
24#define I_DmrppRequestHandler_H
25
26#include <string>
27#include <memory>
28#include <ostream>
29
30#include "BESRequestHandler.h"
31#include "DMZ.h"
32
33class ObjMemCache; // in bes/dap
34class BESContainer;
36
37namespace libdap {
38 class DMR;
39 class DDS;
40}
41
42namespace dmrpp {
43
44class CurlHandlePool;
45
46class DmrppRequestHandler: public BESRequestHandler {
47
48private:
49 // These are not used. See the netcdf handler for an example of their use.
50 // jhrg 4/24/18
51 // These are now used - not sure when we started using them. We might also
52 // look into whether these and the MDS are really appropriate for the DMR++
53 // code since it is, effectively, using cached metadata. The MDS caches info
54 // as XML, and the DMR++ is XML, so the difference is negligible. In the case
55 // of the memory cache, the size of the DMZ in memory may be an issue.
56 // jhrg 11/12/21
57 static std::unique_ptr<ObjMemCache> das_cache;
58 static std::unique_ptr<ObjMemCache> dds_cache;
59
60 static bool d_use_object_cache;
61 static unsigned int d_object_cache_entries;
62 static double d_object_cache_purge_level;
63
64
65 static void get_dmrpp_from_container_or_cache(BESContainer *container, libdap::DMR *dmr);
66 template <class T> static void get_dds_from_dmr_or_cache(BESContainer *container, T *bdds);
67
68 // Allocate a new DMZ for each request? This should work, but may result in more
69 // cycling of data in and out of memory. The shared_ptr<> will be passed into
70 // instances of BaseType and used from withing the specialized read methods.
71 // jhrg 11/3/21
72 static std::shared_ptr<DMZ> dmz;
73
74public:
75 explicit DmrppRequestHandler(const std::string &name);
76 ~DmrppRequestHandler() override;
77
78 static CurlHandlePool *curl_handle_pool;
79
80 static bool d_use_transfer_threads;
81 static unsigned int d_max_transfer_threads;
82
83 static bool d_use_compute_threads;
84 static unsigned int d_max_compute_threads;
85
86 static unsigned long long d_contiguous_concurrent_threshold;
87
88 static bool d_require_chunks;
89
90 // In the original DMR++ documents, the order of the filters used by the HDF5
91 // library when writing chunks was ignored. This lead to an unfortunate situation
92 // where the nominal order of 'deflate' and 'shuffle' were reversed for most
93 // (all?). But the older dmrpp handler code didn't care since it 'knew' how the
94 // filters should be applied. When we fixed the code to treat the order of the
95 // filters correctly, the old files failed with the new handler code. This flag
96 // is used to tell the DmrppCommon code that the filter information is being
97 // read from an old DMR++ document and the filter order needs to be corrected.
98 // This is a kludge, but it seems to work for the data in NGAP PROD as of 11/9/21.
99 // Newer additions will have newer DMR++ docs and those have a new xml attribute
100 // that makes it easy to identify them and not apply this hack. jhrg 11/9/21
101 static bool d_emulate_original_filter_order_behavior;
102
103 static bool is_netcdf4_enhanced_response;
104 static bool is_netcdf4_classic_response;
105 static bool disable_direct_io;
106
107 static bool dap_build_dmr(BESDataHandlerInterface &dhi);
109 static bool dap_build_das(BESDataHandlerInterface &dhi);
110 static bool dap_build_dds(BESDataHandlerInterface &dhi);
112
113 static bool dap_build_vers(BESDataHandlerInterface &dhi);
114 static bool dap_build_help(BESDataHandlerInterface &dhi);
115
116 void dump(std::ostream &strm) const override;
117};
118
119} // namespace dmrpp
120
121#endif // DmrppRequestHandler.h
A container is something that holds data. E.G., a netcdf file or a database entry.
Represents an OPeNDAP DataDDS DAP2 data object within the BES.
Structure storing information used by the BES to handle the request.
An in-memory cache for DapObj (DAS, DDS, ...) objects.
Definition ObjMemCache.h:83
static bool dap_build_dds(BESDataHandlerInterface &dhi)
void dump(std::ostream &strm) const override
dumps information about this object
static bool dap_build_dap2data(BESDataHandlerInterface &dhi)
static bool dap_build_dmr(BESDataHandlerInterface &dhi)
static bool dap_build_das(BESDataHandlerInterface &dhi)
static bool dap_build_dap4data(BESDataHandlerInterface &dhi)
Build a DAP4 data response. Adds timing to dap_build_dmr()
DmrppRequestHandler(const std::string &name)