bes Updated for version 3.20.13
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 <ostream>
28
29#include "BESRequestHandler.h"
30#include "DMZ.h"
31
32class ObjMemCache; // in bes/dap
33class BESContainer;
35
36namespace libdap {
37 class DMR;
38 class DDS;
39}
40
41namespace dmrpp {
42
43class CurlHandlePool;
44
46
47private:
48 // These are not used. See the netcdf handler for an example of their use.
49 // jhrg 4/24/18
50 // These are now used - not sure when we started using them. We might also
51 // look into whether these and the MDS are really appropriate for the DMR++
52 // code since it is, effectively, using cached metadata. The MDS caches info
53 // as XML, and the DMR++ is XML, so the difference is negligible. In the case
54 // of the memory cache, the size of the DMZ in memory may be an issue.
55 // jhrg 11/12/21
56 static ObjMemCache *das_cache;
57 static ObjMemCache *dds_cache;
58 static ObjMemCache *dmr_cache;
59
60 // These are static because they are used by the static public methods.
61 static void build_dmr_from_file(BESContainer *container, libdap::DMR* dmr);
62 template <class T> static void get_dds_from_dmr_or_cache(BESDataHandlerInterface &dhi, T *bdds);
63
64 // Allocate a new DMZ for each request? This should work, but may result in more
65 // cycling of data in and out of memory. The shared_ptr<> will be passed into
66 // instances of BaseType and used from withing the specialized read methods.
67 // jhrg 11/3/21
68 static std::shared_ptr<DMZ> dmz;
69
70public:
71 explicit DmrppRequestHandler(const std::string &name);
72 ~DmrppRequestHandler() override;
73
74 static CurlHandlePool *curl_handle_pool;
75
76 static bool d_use_transfer_threads;
77 static unsigned int d_max_transfer_threads;
78
79 static bool d_use_compute_threads;
80 static unsigned int d_max_compute_threads;
81
82 static unsigned long long d_contiguous_concurrent_threshold;
83
84 static bool d_require_chunks;
85
86 // In the original DMR++ documents, the order of the filters used by the HDF5
87 // library when writing chunks was ignored. This lead to an unfortunate situation
88 // where the nominal order of 'deflate' and 'shuffle' were reversed for most
89 // (all?). But the older dmrpp handler code didn't care since it 'knew' how the
90 // filters should be applied. When we fixed the code to treat the order of the
91 // filters correctly, the old files failed with the new handler code. This flag
92 // is used to tell the DmrppCommon code that the filter information is being
93 // read from an old DMR++ document and the filter order needs to be corrected.
94 // This is a kludge, but it seems to work for the data in NGAP PROD as of 11/9/21.
95 // Newer additions will have newer DMR++ docs and those have a new xml attribute
96 // that makes it easy to identify them and not apply this hack. jhrg 11/9/21
97 static bool d_emulate_original_filter_order_behavior;
98
99 static bool dap_build_dmr(BESDataHandlerInterface &dhi);
101 static bool dap_build_das(BESDataHandlerInterface &dhi);
102 static bool dap_build_dds(BESDataHandlerInterface &dhi);
104
105 static bool dap_build_vers(BESDataHandlerInterface &dhi);
106 static bool dap_build_help(BESDataHandlerInterface &dhi);
107
108 void dump(std::ostream &strm) const override;
109};
110
111} // namespace dmrpp
112
113#endif // DmrppRequestHandler.h
A container is something that holds data. E.G., a netcdf file or a database entry.
Definition: BESContainer.h:65
Represents an OPeNDAP DataDDS DAP2 data object within the BES.
Structure storing information used by the BES to handle the request.
Represents a specific data type request handler.
An in-memory cache for DapObj (DAS, DDS, ...) objects.
Definition: ObjMemCache.h:84
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()